我在 Apache 中定义了 2 个虚拟主机:
站点1:
<VirtualHost *:8080>
ServerAdmin [email protected]
ServerName site1.mydomain.com
DocumentRoot /var/www/site1/www
</VirtualHost>
站点2:
<VirtualHost *:8080>
ServerAdmin [email protected]
ServerName site2.mydomain.com
DocumentRoot /var/www/site2/www
</VirtualHost>
启用它们后,我尝试重新启动 apache,但收到以下错误:
* Restarting web server apache2
[Fri Feb 14 17:06:15 2014] [warn] _default_ VirtualHost overlap on port 8080,
the first has precedence
... waiting .
[Fri Feb 14 17:06:17 2014] [warn] _default_ VirtualHost overlap on port 8080,
the first has precedence
我以为只要我有ServerName
不同域的指令,我就可以在我的 Apache 安装中拥有多个站点。我遗漏了什么吗?
答案1
您还需要NameVirtualHost *:8080
看http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost