/etc/apache2/conf.d/virtul.conf
:
NameVirtualHost *
在第一个文件中,sites-enabled/website1.org
您将看到如下组:
<VirtualHost *>
ServerName website1.org
</VirtualHost>
website2.org 也一样
website1.org 中的域名(和子域名)完全正常工作。但是 website2.org 却无法正常工作。在浏览器中访问 website2.org 时,我得到了500 Internal Server Error
两点注意事项:1)运行时# /etc/init.d/apache2 restart
我得到:
* Restarting web server apache2 [Tue Jul 24 09:31:59 2012] [warn] NameVirtualHost 72.10.54.89:80 has no VirtualHosts
... waiting [Tue Jul 24 09:32:00 2012] [warn] NameVirtualHost 1.23.456.769:80 has no VirtualHosts
2) website2.org 有一个 SSL 证书,并且 SSL VH 设置为sites-enabled/website2.org-ssl
仅供参考,是的,我a2ensite
为每个域运行了,然后运行了 apache reload
,在全部设置完成后,我运行了 apache restart
。
我该怎么做才能让我的第二个网站上线?我不知道下一步该检查什么。谢谢帮助。
** 编辑@RedFoxy **
* Restarting web server apache2 [Tue Jul 24 10:56:57 2012] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Tue Jul 24 10:56:57 2012] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Tue Jul 24 10:56:57 2012] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Tue Jul 24 10:56:57 2012] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Tue Jul 24 10:56:57 2012] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Tue Jul 24 10:56:57 2012] [warn] NameVirtualHost 72.10.54.89:80 has no VirtualHosts
[Tue Jul 24 10:56:57 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
... waiting [Tue Jul 24 10:56:58 2012] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Tue Jul 24 10:56:58 2012] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Tue Jul 24 10:56:58 2012] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Tue Jul 24 10:56:58 2012] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Tue Jul 24 10:56:58 2012] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Tue Jul 24 10:56:58 2012] [warn] NameVirtualHost 72.10.54.89:80 has no VirtualHosts
[Tue Jul 24 10:56:58 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
答案1
很简单,只需指定端口即可:
NameVirtualHost *:80
和
<VirtualHost *:80>
ServerName website1.org
</VirtualHost>
记得将 :80 改为你需要的 Web 端口