1.打开httpd.conf文件(/etc/httpd/conf)
2.找到#Includeconf/extra/httpd-vhosts.conf这句,将之前的#号去掉,开启假造主机设置。假如没有找到#Includeconf/extra/httpd-vhosts.conf这句,则找到假造主机设置文件路径,在httpd.conf中添加”Include假造主机设置文件路径”。
3.编辑假造主机设置文件(/usr/share/doc/httpd-2.4/httpd-vhosts.conf)
VirtualHost*:80ServerAdminwebmaster@dummy-host1.example.comDocumentRoot"/Apache24/docs/dummy-host1.example.com"ServerNamedummy-host1.example.comServerAliaswww.dummy-host1.example.comErrorLog"logs/dummy-host1.example.com-error.log"CustomLog"logs/dummy-host1.example.com-access.log"common/VirtualHostVirtualHost*:80ServerAdminwebmaster@dummy-host2.example.comDocumentRoot"/Apache24/docs/dummy-host2.example.com"ServerNamedummy-host2.example.comServerAliaswww.dummy-host2.example.comErrorLog"logs/dummy-host2.example.com-error.log"CustomLog"logs/dummy-host2.example.com-access.log"common/VirtualHost
4.编辑hosts文件(/etc/hosts)
在hosts文件中添加以下内容:127.0.0.1ser1.com127.0.0.1ser2.com
5.重启服务器:servicehttpdrestart到此多站点设置完成
泉源:lonelyworld.cn
我要评论