apache 本地配置虚拟主机,单ip多域名
1、打开httpd.conf 查找 #Include conf/extra/httpd-vhosts.conf 将前面#去掉
2、打开 conf/extra/httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mysite1.com
DocumentRoot "E:/phpworks/apache/htdocs/mysite1"
ErrorLog "logs/dummy-host2.127.0.0.1-error.log"
CustomLog "logs/dummy-host2.127.0.0.1-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName mysite2.com
DocumentRoot "E:/phpworks/apache/htdocs/mysite2"
ErrorLog "logs/dummy-host2.127.0.0.1-error.log"
CustomLog "logs/dummy-host2.127.0.0.1-access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "E:/phpworks/apache/htdocs/mysite3"
ServerName mysite3.com
ErrorLog "logs/dummy-host2.127.0.0.1-error.log"
CustomLog "logs/dummy-host2.127.0.0.1-access.log" common
</VirtualHost>
3、修改host
127.0.0.1 mysite1.com
127.0.0.1 mysite2.com
127.0.0.1 mysite3.com
?