Apache下同一个IP配置多个虚拟主机

 新闻资讯     |      2019-08-13

比如你的IP地址为: 192.100.100.1,则Apache服务器的配置文件可以这样写:

 VirtualHost 192.100.100.1 
 ServerAdmin njzadmin@sina.com
 DocumentRoot /wwwroot
 ServerName www.a.com
 ErrorLog logs/a.com-error_log
 Customlog logs/a-access_log common
 /VirtualHost 
 VirtualHost 192.100.100.1 
 ServerAdmin sonymusic@china.com
 DocumentRoot /wwwroot2
 ServerName www.b.com
 ErrorLog logs/b.com-error_log
 CustomLog log