Apache 不会遵循符号链接 (403 Forbidden) [英] Apache won't follow symlinks (403 Forbidden)

查看:28
本文介绍了Apache 不会遵循符号链接 (403 Forbidden)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Ubuntu 上设置 Apache 时遇到了一些问题.我一直在关注本指南.

I'm having some trouble setting up Apache on Ubuntu. I've been following this guide.

# /usr/sbin/apache2 -v
Server version: Apache/2.2.17 (Ubuntu)
Server built:   Feb 22 2011 18:33:02

我的公共目录/var/www 可以成功提供和执行放置在其中的 PHP 页面.但是,我想在/var/www 中创建一个符号链接,指向我的主文件夹中的一个目录并在那里提供页面.

My public directory, /var/www, can successfully serve up and execute PHP pages that are placed in it. However, I want to create a symlink in /var/www that points to a directory in my home folder and serve pages there.

[root /var/www]# ll
total 36
drwxr-xr-x  3 root root 4096 2011-09-11 14:22 .
drwxr-xr-x 14 root root 4096 2011-06-04 22:49 ..
lrwxrwxrwx  1 root root   16 2011-09-11 13:21 about -> /root/site/about

当我尝试在浏览器上访问/about 时,我得到

When I try to access /about on browser, I get

Forbidden

You don't have permission to access /about on this server.

据我所知,我给了我想要提供的文件足够的权限:

As far as I know, I gave sufficient privileges to the files I want to serve:

[root ~/site/about]# ll
total 24
drwxr-xr-x 5 root root 4096 2011-09-11 13:20 .
drwxr--r-- 3 root root 4096 2011-09-11 13:19 ..
drwxr-xr-x 2 root root 4096 2011-09-11 13:21 contact
-rwxr-xr-x 1 root root 1090 2011-09-11 13:19 index.php
drwxr-xr-x 2 root root 4096 2011-09-11 13:20 me
drwxr-xr-x 2 root root 4096 2011-09-11 13:21 resume

我知道 FollowSymLinks 选项,我相信它是在我的/etc/apache2/sites-enabled/000-default 文件中设置的:

I'm aware of the FollowSymLinks option, and I believe it's set in my /etc/apache2/sites-enabled/000-default file:

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/>
    Options FollowSymLinks Indexes MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

知道我可能遗漏了什么吗?

Any idea what I could be missing?

推荐答案

检查 Apache 是否具有 /root/root/site/的执行权限根/站点/关于.

Check that Apache has execute rights for /root, /root/site and /root/site/about.

运行:

chmod o+x /root /root/site /root/site/about

您可以在以利亚的回答中找到更安全的方法.

You can find a more secure way in Elijah's answer.

这篇关于Apache 不会遵循符号链接 (403 Forbidden)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆