403在Web根紫禁城的符号链接 [英] 403 Forbidden on symlink in web root
问题描述
我就在没有shell访问一个LAMP组合共享的托管包。
I am on a shared hosting package on a LAMP stack with no shell access.
我可以创建使用PHP的符号链接符号链接()
功能。
I can create symlinks using PHP's symlink()
function.
比方说我的网站根目录是 /家庭/网络/用户1 /公
Let's say my web root is /home/www/user1/public
让我们说我有一个名为真实目录 /家庭/网络/用户1 /公/ real_dir
Let's say I have a real directory named /home/www/user1/public/real_dir
和我创建一个名为符号链接 /家庭/网络/用户1 /公/ fake_dir
指向 real_dir
And I create a symlink named /home/www/user1/public/fake_dir
pointing to real_dir
为什么我会得到一个 403禁止试图访问 www.mydomain.com/fake_dir
时,而不是试图访问时 www.mydomain.com/real_dir
?
Why would I get a 403 Forbidden when trying to access www.mydomain.com/fake_dir
but not when trying to access www.mydomain.com/real_dir
?
这不应该是一个权利问题,因为当我在PHP中创建一个文件,我可以访问所有权利。
It shouldn't be a rights problem because when I create a file in PHP, I can access that all right.
我试图切换的FollowSymLinks
在.htaccess和关闭(这是),但没有运气。
I tried switching FollowSymlinks
off and on in .htaccess (it was on), but no luck.
难道说的FollowSymLinks
被定义为.htaccess文件不可覆盖?还是有别的东西要知道在Apache中使用符号连接时的?
Could it be that FollowSymlinks
is defined as not overwritable in a .htaccess file? Or is there something else to be aware of when working with Symlinks in Apache?
推荐答案
阿帕奇必须配置为允许访问文件系统上的目录。这必须由系统管理员通过插入LT及完成;在Apache的配置文件目录>指令(httpd.conf文件)
Apache has to be configured to allow access to the directory on the filesystem. This has to be done by a system administrator by inserting a <Directory> directive in the apache configuration files (httpd.conf).
由于实际目录是Web根内它必须是可访问的,但有FollowSymLinks可能没有被用于目录启用 - 这也已被添加到的&lt; Directory>指令
Since the real directory is inside the web root it must be accessible, but FollowSymLinks may not have been enabled for the directory - this also has to be added to the <Directory> directive.
请参阅 http://httpd.apache.org/docs/2.0 /mod/core.html#directory
这篇关于403在Web根紫禁城的符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!