【问题标题】:Symlink error 403 with apache使用 apache 的符号链接错误 403
【发布时间】:2014-07-15 15:26:29
【问题描述】:

我的/srv/http/ 文件夹中有一个符号链接mysite 指向/home/some-user/somefolder。 在我的/etc/httpd/conf/httpd.conf,根据这个网站和互联网上其他论坛的许多帖子,我设置了以下内容:

<Directory />
            Options FollowSymLinks
            AllowOverride None    
</Directory>

DocumentRoot "/srv/http"
<Directory "/srv/http">
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
</Directory>

然后我将权限以递归方式更改为 777 到我的符号链接目标文件夹,如下所示:

chmod 777 -R /home/some-user/some-folder

但如果我打开我的网络浏览器并输入http://localhost/mysite/mypage.php,我会收到以下错误:

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

localhost
Apache/2.4.9 (Unix) PHP/5.5.14

我已经阅读了很多文章说这样做,但我仍然可以让它工作......

【问题讨论】:

  • Apache 访问和错误日​​志中对应的行是什么?
  • 好的,发现了!我还需要 chmod o+x /home/some-user (我的站点文件夹的父文件夹)

标签: php apache symlink http-status-code-403


【解决方案1】:

你应该 chmod o+x 整个路径,apache 会经过。 所以在你的情况下:

sudo chmod o+x /home/

sudo chmod o+x /home/some-user/

sudo chmod o+x /home/some-user/somefolder

【讨论】:

    【解决方案2】:

    好的,发现了!我还需要chmod o+x /home/some-user(我的站点文件夹的父文件夹)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-28
      • 2019-09-11
      • 1970-01-01
      • 2014-08-20
      • 2020-08-28
      • 2013-04-01
      相关资源
      最近更新 更多