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

我正在尝试在 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 文件的内容:

名称虚拟主机 *

<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>

编辑:按照 kaji 的建议进行修改,

apache2 restart 的输出

* 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]

答案1

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

尝试这个

# 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>

相关内容