Ubuntu 14.04 Apache 2.4.7 404 Not Found

时间:2016-03-29 22:45:15

标签: apache apache2 ubuntu-14.04 apache2.4

我一直在阅读论坛并尝试复制他们的修补程序,但我必须遗漏一些东西,因为它会从简单的 404 Error Mis Found 转换为 403禁止错误(即使在chown和chmod更改后)。

目前,即使在sudo apache2ctl restart

之后,我也遇到了403错误代码

这是我到目前为止所做的。 - gedit apache2.conf,包含以下内容

<Directory /path/to/directory/>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>
  • gedit sites-available / 000-default.conf&amp;&amp; sites-enabled / 000-default.conf

    DocumentRoot /path/to/directory
        <Directory />
            Options FollowSymLinks
            AllowOverride All
        </Directory>
        <Directory /path/to/directory>
            Options Indexes FollowSymLinks MultiViews
            Order allow,deny
            allow from all
        </Directory>
    
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
            Options Indexes FollowSymLinks MultiViews
            Order allow,deny
            Allow from all
        </Directory>
    

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

首先请注意,您现在拥有Apache 2.4,而不是Apache 2.2。使用Apache 2.4声明权限的样式已经改变,您应该始终使用新的样式(如require all granted)。

Apache在允许提供的文件方面变得更加严格。基本上,在文档根目录及其下方安排要在外部提供的文件,并将所有其他文件保留在此树之外。不要链接到文档根目录树之外的文件。

您的配置的一些要点:

 <Directory />

这是文件系统的根目录。如果您为它声明任何内容,那么它应该是require all denied而不是其他内容。请注意,<Directory /absolute/path/to/some/directory>指令和<location /relative/path/to some/location/on/your/server>指令之间存在差异。

根据<location>

配置您的服务器
相关问题