资源预览内容
第1页 / 共8页
第2页 / 共8页
第3页 / 共8页
第4页 / 共8页
第5页 / 共8页
第6页 / 共8页
第7页 / 共8页
第8页 / 共8页
亲,该文档总共8页全部预览完了,如果喜欢就下载吧!
资源描述
Apache 服务器基本配置一、基本的服务器搭建1、vim /etc/httpd/conf/httpd.conf(1)修改主配置文件httpd.conf设置Apache的根目录为/etc/httpd设置客户端访问超时时间为120秒这两个设置为系统默认57行和68行(2)设置客户端最大连接数为1000104、105行推荐精选(3)设置httpd监听端口80,默认134行(4)设置管理员E-mail地址为rootbenet.com251行设置WEB服务器的主机名和监听端口为www.benet.com:80265行推荐精选(5)设置文档目录为/www281行(6)允许所有人访问/var/www/html/file目录306、333行 (此行可不配置)推荐精选(7)设置主页文件为index.html391行推荐精选(8)设置服务器的默认编码为GB2312747行(9)重新启动httpdrootdns Server# mkdir /www (重要一步,不然不能启动)rootdns Server# vim /www /index.html rootdns Server# service httpd restart推荐精选停止 httpd: 确定启动 httpd: 确定rootdns Server# setup设置防火墙二、多个站点的搭建1、基于ip地址的站点搭建rootwww # vim /etc/httpd/conf/httpd.conf其次在主配置文件的最后加上如下配置 ServerAdmin webmasterdummy-host.example.com DocumentRoot /www/1 ServerName dummy-host.example.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common ServerAdmin webmasterdummy-host.example.com DocumentRoot /www/2 ServerName dummy-host.example.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common配置完成后重启服务rootwww # service httpd restart然后在IE浏览器进行访问测试2、基于端口的站点搭建rootwww # vim /etc/httpd/conf/httpd.conf首先加上如下配置,监听端口:推荐精选Listen 801Listen 802其次在主配置文件的最后加上如下配置 ServerAdmin webmasterdummy-host.example.com DocumentRoot /www/1 ServerName dummy-host.example.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common ServerAdmin webmasterdummy-host.example.com DocumentRoot /www/2 ServerName dummy-host.example.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common配置完成后重启服务rootwww # service httpd restart然后在IE浏览器进行访问测试3、基于域名的站点搭建首先必须保证DNS服务器正常运行rootwww # vim /etc/httpd/conf/httpd.conf首先把#NameVirtualHost *:80改为如下配置:NameVirtualHost 192.168.0.223:80其次在主配置文件的最后加上如下配置 ServerAdmin webmasterdummy-host.example.com推荐精选 DocumentRoot /www/1 ServerName www1.zzptc.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common ServerAdmin webmasterdummy-host.example.com DocumentRoot /www/2 ServerName www2.zzptc.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common配置完成后重启服务rootwww # service httpd restart然后在IE浏览器进行访问测试 (注:可编辑下载,若有不当之处,请指正,谢谢!) 推荐精选
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号