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

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

尝试“apache2 restart”时的输出

* Restarting web server apache2                                                
[Thu Feb   09 00:55:09 2012] [warn] NameVirtualHost 71.19.144.240:80 has no VirtualHosts
[Thu Feb 09 00:55:09 2012] [warn] NameVirtualHost *:0 has no VirtualHosts
[Thu Feb 09 00:55:09 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Thu Feb 09 00:55:09 2012] [warn] NameVirtualHost xxx.xxx.xxx:80 has no VirtualHosts
[Thu Feb 09 00:55:09 2012] [warn] NameVirtualHost *:0 has no VirtualHosts
[Thu Feb 09 00:55:09 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
(98)Address already in use: make_sock: could not bind to address [::]:80
                                                                     [fail]

httpd.conf 文件:GNU nano 2.2.2 文件:httpd.conf

Listen 80
NameVirtualHost *:80

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


<VirtualHost *>
ServerName www.xxxxx.com
DocumentRoot /srv/www/xxxxxx.com/public_html/
</VirtualHost>

答案1

Address already in use: make_sock: could not bind to address [::]:80

这意味着某些程序已经在 80 端口下运行。我猜你正在使用

/etc/init.d/apache2 restart

尝试重新启动服务器。先尝试停止服务以进行调试。

再次从 Ubuntu 发行版的角度来看:

NameVirtualHost *:80
Listen 80

应该被淘汰

/etc/apache2/ports.conf

和虚拟主机配置选项

<VirtualHost *:80>
ServerName www.xxxxx.com
DocumentRoot /srv/www/xxxxxx.com/public_html/
</VirtualHost>

应该放在 /etc/apache2/sites-available 下的一个不同文件下,该文件稍后会符号链接到 /etc/apache2/sites-enabled,以便 apache 查看它是否在 apache 的默认 ubuntu 配置中。

相关内容