我在 Amazon 上设置了一个包含 3 个虚拟主机的 Web 服务器。出于某种原因,我无法让任何网站运行,它们都显示 404 错误。/var/log/apache2/error.log 显示“文件不存在:/etc/apache2/htdocs”
我检查过:
- a2ensite 我的所有虚拟主机
- 实际上检查了 sites-enabled 中的软链接
- 如果用户不是 www-data,则 /var/www 的访问权限为 777
- 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>
答案1
也许尝试使用 apt-get remove/ apt-get install 重新安装 Apache
答案2
检查你的配置文件,看起来你配置错误了文档根目录指示。
您确实也不希望在文件系统的 Web 可访问部分的任何地方拥有 777 个权限。