我认为这个问题的标题非常多说这个问题。 当我重新启动httpd时,出现这两个错误:
[Wed Jun 22 13:39:23 2011] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Wed Jun 22 13:39:23 2011] [warn] NameVirtualHost *:80 has no VirtualHosts
我包括一个文件,这是唯一的一行:
NameVirtualHost *:80
而且这两个VirtualHosts几乎都是这样的:
<VirtualHost *:80> ServerAdmin webmaster@<other-name>.com DocumentRoot /var/www ServerName www.<name>.com ServerAlias <name>.com *.<name>.com <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/httpd/error_log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/httpd/access_log combined </VirtualHost>
显然,我错过了一些明显的影响这个结果的东西,但我不知道是什么。 (显然,这两个网站目前正在指向同一页面)
(不确定如果这件事,但我可以使用CentOS)。
下面完全赞赏Mike Diehn的解决scheme,但是它的解决scheme与他的build议略有不同。
我跑了:
/usr/sbin/httpd -t -D DUMP_VHOSTS
我得到了
[Wed Jun 22 14:23:20 2011] [warn] _default_ VirtualHost overlap on port 80, the first has precedence [Wed Jun 22 14:23:20 2011] [warn] NameVirtualHost *:80 has no VirtualHosts VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: _default_:443 <name-one>.com (/etc/httpd/conf.d/ssl.conf:81) *:80 www.<name-one>.com (/etc/httpd/conf/sites-enabled/100-default:1) *:80 www.<name-two>.info (/etc/httpd/conf/sites-enabled/200-info:1) *:* www.<!!!!!!!!!!!!!!>.com (/etc/httpd/conf/sites-enabled/6-<bad>.com:1) Syntax OK
注意!!!!!!!!!!! ? 那是在那里,因为我不小心从别的地方复制它。 它吞噬了一切,使它无法正常工作。
你确定你的NameVirtualHost指令实际上是被Apache“看到”吗? 这是我们看到的常见错误
嘿,试试这个命令:
/ usr / sbin / apache2ctl -t -D DUMP_VHOSTS
以下是我在服务器上看到的对我来说正确的工作:
VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:* is a NameVirtualHost default server loghost.example.com (/etc/apache2/vhosts.d/10_loghost.example.com.conf:4) port * namevhost loghost.example.com (/etc/apache2/vhosts.d/10_loghost.example.com.conf:4) port * namevhost netflow.example.com (/etc/apache2/vhosts.d/20_netflow.fluent.com.conf:4) port * namevhost licensewatch.example.com (/etc/apache2/vhosts.d/40_licensewatch.example.com.conf:8) Syntax OK