我正在尝试在Apache2中使用虚拟主机设置多个域。 当我尝试浏览到我的网站时,当前正在收到“无法连接”错误,并且每当我尝试重新启动Apache2时,都会收到有关“没有可用的套接字,closures无法打开日志”的错误。
最初,configurationapache2.conf和我的/apache2/sites-enabled/domain1.com后,我得到一个500服务器错误,并从apache2警告“NameVirtualHost *:80没有VirtualHosts”。 然后我在ports.conf文件中注释了一个额外的(我认为)NameVirtualHost *:80,现在无法连接,也没有套接字错误。
以下是我的apache2.conf的底部:
NameVirtualHost *:80 #<VirtualHost *:80> <IfModule mod_ssl.c> NameVirtualHost *:443 </IfModule>
和我的/apache2/sites-enabled/domain1.com:
# domain: domain1.com # public: /home/demo/public_html/domain1.com/ <VirtualHost *:80> # Admin email, Server Name (domain name) and any aliases ServerAdmin [email protected] ServerName domain1.com ServerAlias domain1.com # Index file and Document Root (where the public files are located) DirectoryIndex index.html DocumentRoot /home/demo/public_html/domain1.com/public # Custom log file locations LogLevel warn ErrorLog /home/demo/public_html/domain1.com/log/error.log CustomLog /home/demo/public_html/domain1.com/log/access.log combined </VirtualHost>
最后,我的ports.conf:
#NameVirtualHost *:80 #Listen 80 <IfModule mod_ssl.c> # If you add NameVirtualHost *:443 here, you will also have to change # the VirtualHost statement in /etc/apache2/sites-available/default-ssl # to <VirtualHost *:443> # Server Name Indication for SSL named virtual hosts is currently not # supported by MSIE on Windows XP. Listen 443 </IfModule> <IfModule mod_gnutls.c> Listen 443 </IfModule>
我感谢任何可以提供的见解。
看起来你已经注释掉了Listen 80行,所以Apache并没有在正常的http端口上进行监听。
其他的Listen指令位于IfModule块内部,所以如果这些模块不存在,那么您已经有效地将Apacheconfiguration为不侦听任何端口,这可能是错误的根源。
尝试取消注释行:
Listen 80
在你的ports.conf中。