我试图在Ubuntu服务器上使用apache 2.x在新的VPS上设置2个虚拟主机

apache2重新启动输出:

* Restarting web server apache2 [Thu Feb 09 01:19:34 2012] [warn] NameVirtualHost xx.xx.xxx.xxx:80 has no VirtualHosts [Thu Feb 09 01:19:34 2012] [warn] NameVirtualHost *:0 has no VirtualHosts [Thu Feb 09 01:19:34 2012] [warn] NameVirtualHost *:0 has no VirtualHosts [Thu Feb 09 01:19:34 2012] [warn] NameVirtualHost xx.Xx.xxx.xxx:80 has no VirtualHosts [Thu Feb 09 01:19:34 2012] [warn] NameVirtualHost *:0 has no VirtualHosts [Thu Feb 09 01:19:34 2012] [warn] NameVirtualHost *:0 has no VirtualHosts [fail] 

httpd.conf文件的内容:

NameVirtualHost *

 <VirtualHost *> ServerName www.xxxx.net DocumentRoot /srv/www/xxxx.net/public_html/ </VirtualHost> <VirtualHost *> ServerName www.xxxx.com DocumentRoot /srv/www/xxxx.com/public_html/ </VirtualHost> 

编辑:由kajibuild议的更改,

从apache2重新启动输出

 * Restarting web server apache2 Warning: DocumentRoot [/www/rmusser.net] does not exist [Thu Feb 09 01:41:03 2012] [error] VirtualHost *:8090 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results [Thu Feb 09 01:41:03 2012] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results [Thu Feb 09 01:41:03 2012] [warn] NameVirtualHost 71.19.144.240:80 has no VirtualHosts [Thu Feb 09 01:41:03 2012] [warn] NameVirtualHost *:0 has no VirtualHosts [Thu Feb 09 01:41:03 2012] [warn] NameVirtualHost *:80 has no VirtualHosts Warning: DocumentRoot [/www/rmusser.net] does not exist [Thu Feb 09 01:41:03 2012] [error] VirtualHost *:8090 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results [Thu Feb 09 01:41:03 2012] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results [Thu Feb 09 01:41:03 2012] [warn] NameVirtualHost 71.19.144.240:80 has no VirtualHosts [Thu Feb 09 01:41:03 2012] [warn] NameVirtualHost *:0 has no VirtualHosts [Thu Feb 09 01:41:03 2012] [warn] NameVirtualHost *:80 has no VirtualHosts (98)Address already in use: make_sock: could not bind to address [::]:80 [fail] 

您没有在虚拟主机定义中指定端口

尝试这个

 # Ensure that Apache listens on port 80 Listen 80 # Listen for virtual host requests on all IP addresses NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /www ServerName www.example1.com # Other directives here </VirtualHost> <VirtualHost *:8090> DocumentRoot /www/folder ServerName www.example2.org # Other directives here </VirtualHost>