我在亚马逊上设置了一个带有 3 个虚拟主机的 Web 服务器。出于某种原因,我无法访问任何网站,它们都显示 404 错误。/var/log/apache2/error.log 显示“文件不存在:/etc/apache2/htdocs”
我检查过:
- a2ensite 我所有的虚拟主机
- 实际上检查了启用站点的软链接
- /var/www 中的访问权限为 777,以防用户不是 www-data
- grep -r htdocs /etc/apache2(不返回任何内容)
- ports.conf 具有与虚拟主机完全匹配的 NameVirtualHost 指令
这还能是什么?
ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
NameVirtualHost 107.20.169.163: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>
sites-available/www.seleconlight.com
<VirtualHost 107.20.169.163:80>
ServerName www.seleconlight.com
DocumentRoot /var/www/www.seleconlight.com
CustomLog /var/log/apache2/www.seleconlight.com-access.log combined
ErrorLog /var/log/apache2/www.seleconlight.com-error.log
</VirtualHost>
检查您的配置文件,您似乎配置了错误的DocumentRoot指令。
你真的不希望在你的文件系统的 web 可访问部分的任何地方有 777 个权限。
也许尝试使用 apt-get remove/ apt-get install 重新安装 Apache