2013-12-10 75 views
0

我试图配置两个运行在同一个apache服务器上的虚拟主机。不知何故,我尝试配置Apache总是有问题,我的配置。下面是配置文件在apache2上配置虚拟主机的麻烦

Listen 80 
Listen 8080 

NameVirtualHost 172.16.10.2:80 
NameVirtualHost 172.16.10.2:8080 

<VirtualHost 172.16.10.2:80> 
    ServerName be.wincars.local 
    DocumentRoot /var/www/wincarsbe 
    CustomLog /var/www/logs/wincarsbe.log combined 
    ErrorLog /var/www/logs/wincarsbe.log 
</VirtualHost> 

<VirtualHost 172.16.10.2:8080> 
    ServerName com.wincars.local 
    DocumentRoot /var/www/wincarscom 
    CustomLog/var/www/logs/wincarscom.log combined 
    ErrorLog /var/www/logs/wincarscom.log 
</VirtualHost> 

当我尝试重新启动Apache,这里是我得到:

apache output

+0

尝试使用ServerAlias – Bijendra

回答

0

试着这么做

Listen 80 
.... 
NameVirtualHost *:80 

<VirtualHost *:80> 
ServerName be.wincars.local 
... 
</VirtualHost> 

<VirtualHost *:80> 
ServerName com.wincars.local 
... 
</VirtualHost> 

你也可以尝试让Apache转储出有关配置的VirtualHosts的信息:

httpd -t -D DUMP_VHOSTS