无法在apache2上配置虚拟主机

时间:2013-12-10 08:42:37

标签: configuration apache2 virtualhost

我正在尝试使用virtualhosts配置在同一个apache服务器上运行的两个站点。无论如何,我试图配置apache总是问题我的配置。这是配置文件

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

1 个答案:

答案 0 :(得分: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