我正在尝试在 Apache2 中使用虚拟主机设置多个域。当我尝试浏览我的网站时,我目前收到“无法连接”错误,每当我尝试重新启动 Apache2 时,我都会收到关于“没有可用的侦听套接字,关闭无法打开日志”的错误。
最初,在配置 apache2.conf 和我的 /apache2/sites-enabled/domain1.com 后,我收到了 500 服务器错误和来自 apache2 的警告,即“NameVirtualHost *:80 has no VirtualHosts”。然后我在ports.conf文件中注释掉了一个额外的(我认为)NameVirtualHost *:80,现在无法连接和没有套接字错误。
这是我的 apache2.conf 底部的内容:
NameVirtualHost *:80
#<VirtualHost *:80>
<IfModule mod_ssl.c>
NameVirtualHost *:443
</IfModule>
Run Code Online (Sandbox Code Playgroud)
而我的/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 admin@domain1.com
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 …Run Code Online (Sandbox Code Playgroud)