同一个ip上不同的基于名称的主机

时间:2013-08-15 18:27:54

标签: apache centos httpd.conf

我需要访问我将在没有域名的情况下安装的wordpress,因为我创建了另一个ip地址,以便在同一个ip上拥有所有基于名称的主机,但是当我重新启动httpd服务时,它会返回几个警告并且所有域名指向第一个。

        Starting httpd: [Thu Aug 15 19:22:58 2013] 
    [warn] VirtualHost 176.111.104.95:80 overlaps with VirtualHost 176.111.104.95:80,
 the first has precedence, perhaps you need a NameVirtualHost directive

    [Thu Aug 15 19:22:58 2013] 
    [warn] VirtualHost 176.111.104.95:80 overlaps with VirtualHost 176.111.104.95:80, 
the first has precedence, perhaps you need a NameVirtualHost directive



<VirtualHost 176.111.104.95:80>
    ServerAdmin admin@carviz.pt
    DocumentRoot /var/www/html/carviz.pt/public_html
    ServerName carviz.pt
    ServerAlias www.carviz.pt
    ErrorLog logs/carviz.pt-error_log
    CustomLog logs/carviz.pt-access_log common
</VirtualHost>
<VirtualHost 176.111.104.95:80>
    ServerAdmin admin@instaclasse.com
    DocumentRoot /var/www/html/instaclasse.com/public_html
    ServerName instaclasse.com
    ServerAlias www.instaclasse.com
    ErrorLog logs/instaclasse.com-error_log
    CustomLog logs/instaclasse.com-access_log common
</VirtualHost>
<VirtualHost 176.111.104.95:80>
    ServerAdmin ftpaul@gmail.com
    DocumentRoot /var/www/html/skala.pt/public_html
    ServerName skala.pt
    ServerAlias www.skala.pt
    ErrorLog logs/skala-error_log
    CustomLog logs/skala-access_log common
</VirtualHost>

我正在关注此示例:http://httpd.apache.org/docs/current/vhosts/examples.html上混合的基于名称和基于IP的虚拟主机

1 个答案:

答案 0 :(得分:0)

您可以在ports.conf

中查看/etc/apache2

你可以在那里添加一些行:

NameVirtualhost 176.111.104.95:80
Listen 176.111.104.95:80

或更好(如果你只使用一个ip)

您可以从

更改当前的虚拟主机
<VirtualHost 176.111.104.95:80>