本文共 3388 字,大约阅读时间需要 11 分钟。
1)打开HTTPD的持续性连接,即KeepAlive,该指令决定当处理完用户发起的HTTP 请求后是否立即关闭 TCP 连接,该次连接能够传输的最大传输数量为500 参考答案: 修改以下的文件: vi /etc/httpd/conf/httpd.conf 修改如下内容: KeepAlive On MaxKeepAliveRequests 500 保存退出 service httpd restart 2)查看当前apache的应用模式 参考答案:httpd -l 3)调整httpd最大的同時连接数量为10000个 参考答案: 修改以下的文件: vi /etc/httpd/conf/httpd.conf 修改如下内容: ServerLimit 10000 MaxClients 10000 保存退出 service httpd restart 4)启动httpd进程的用户为apache 参考答案: 修改以下的文件: vi /etc/httpd/conf/httpd.conf 修改如下内容: User apache Group apache 保存退出 service httpd restart 5)用中文 GB2312 编码 参考答案: 修改以下的文件: vi /etc/httpd/conf/httpd.conf 修改如下内容: AddDefaultCharset GB2312 保存退出service httpd restart 6.1)首頁权限相关设定,更改默认的WEB目录为/web 6.2)增加default.html为默认的索引文件 6.3)在default.html网页中增加"I love China" 参考答案: 修改以下的文件: vi /etc/httpd/conf/httpd.conf 修改如下内容: DocumentRoot "/web"Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all DirectoryIndex default.html index.html index.html.var 保存退出 mkdir /web cat > default.html I love China! service httpd restart 7.1)启动用户的个人网站,用户为test 7.2)用户目录为/home/test/html 7.3)在用户目录下新建index.html文件 7.4)设定目录别名,即访问http://ip/test,即可浏览页面 参考答案: mkdir /home/test/html chmod 755 /home/test/ -R echo "Test your home">>/home/test/html/index.html 修改以下的文件: vi /etc/httpd/conf/httpd.conf#UserDir disable UserDir public_html Alias /test/ "/home/test/html/"Options FollowSymLinks AllowOverride None Order allow,deny Allow from all 保存退出 service httpd restart 8)只让 192.168.1.0/24 这个网段可以浏览 参考答案: 修改以下的文件: vi /etc/httpd/conf/httpd.confOptions FollowSymLinks AllowOverride None Order deny,allow Deny from all allow from 192.168.1.0/24 保存退出service httpd restart 9)主机状态说明网页,只让 192.168.1.0/24和127.0.0.1可以浏览 参考答案: 修改以下的文件: vi /etc/httpd/conf/httpd.conf ExtendedStatus OnSetHandler server-status Order deny,allow Deny from all Allow from 192.168.1.0/24 Allow from 127.0.0.1 保存退出 service httpd restart http://192.168.1.103/server-status 查看 10.1).htaccess 与认证网页设定,认证目录为/web 10.2)认证的用户名test密码qiuming 参考答案: 修改以下的文件: vi /etc/httpd/conf/httpd.confOptions FollowSymLinks AllowOverride AuthConfig Options Indexes FollowSymLinks AllowOverride AuthConfig Order allow,deny Allow from all 保存退出 修改以下的文件: vi /web/.htaccess AuthName "Protect test by .htaccess" Authtype Basic AuthUserFile /var/www/apache.passwd require user test 保存退出 htpasswd -c /var/www/apache.passwd test service httpd restart 11)建立 SSL (https) 网站,ssl访问的目录为/var/www/html 参考答案: cd /etc/httpd/conf/ssl.key mv server.key server.key.raw openssl genrsa -out server.key 1024cd /etc/httpd/conf/ssl.crtmv server.crt server.crt.rawopenssl req -new -x509 -key ../ssl.key/server.key -out server.crt修改以下的文件:vi /etc/httpd/conf.d/ssl.confDocumentRoot "/var/www/html"ServerName *:443保存退出service httpd restart 查看原文:
转载地址:http://tqmdi.baihongyu.com/