解决办法:
打开http.conf
1,ServerName 127.0.0.1 修改成ServerName 202.112.11.22
2,#NameVirtualHost * 修改成"NameVirtualHost 202.112.11.22"
3,在文件最后面有虚拟主机格式,
#<VirtualHost *>
# ServerAdmin
[email protected]# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
简单的添加:
<VirtualHost 202.112.11.22>
DocumentRoot usr/local/www/
ServerName www.mysite.com
</VirtualHost>
<VirtualHost 202.112.11.22>
DocumentRoot usr/local/www/site1/
ServerName www.site1.com
</VirtualHost>
<VirtualHost 202.112.11.22>
DocumentRoot usr/local/www/site2/
ServerName www.site2.com
</VirtualHost>