Apache 给出 403 Forbidden

Apache 给出 403 Forbidden

服务器:Ubuntu 12.04 w/ LAMP 我可以访问默认的 index.html,但我创建了一个指向 Dropbox 中文件夹的符号链接。每当我尝试访问时192.168.2.6/Joomla(Joomla 是符号链接),我都会收到 403 错误。根据这个问题没用。我可以发布配置文件等,只需询问即可。

我尝试使用 chmod 来允许相关文件的所有权限,但这没有帮助。

另外,我删除了默认的 index.html 以强制 Apache 显示 www 目录。它显示了,但是是空的(符号链接不显示)

输出ls -lSrah(在 Joomla 中):

total 7.6M
-rwxrwxr-x  1 somekittens somekittens  865 Mar 31 18:03 robots.txt
-rwxrwxr-x  1 somekittens somekittens 1.3K Mar 31 18:03 index.php
-rwxrwxr-x  1 somekittens somekittens 1.7K Mar 31 18:03 web.config.txt
-rwxrwxr-x  1 somekittens somekittens 1.8K Mar 31 18:07 joomla.xml
-rwxrwxr-x  1 somekittens somekittens 3.1K Mar 31 18:03 htaccess.txt
drwxrwxr-x  2 somekittens somekittens 4.0K Mar 31 18:03 tmp
drwxrwxr-x  6 somekittens somekittens 4.0K Mar 31 18:03 templates
drwxrwxr-x 13 somekittens somekittens 4.0K Mar 31 18:03 plugins
drwxrwxr-x 26 somekittens somekittens 4.0K Mar 31 18:03 modules
drwxrwxr-x 15 somekittens somekittens 4.0K Mar 31 18:03 media
drwxrwxr-x  2 somekittens somekittens 4.0K Mar 31 18:03 logs
drwxrwxr-x  7 somekittens somekittens 4.0K Mar 31 18:03 libraries
drwxrwxr-x  4 somekittens somekittens 4.0K Mar 31 18:03 language
drwxrwxr-x 10 somekittens somekittens 4.0K Mar 31 18:03 installation
drwxrwxr-x  2 somekittens somekittens 4.0K Mar 31 18:03 includes
drwxrwxr-x  4 somekittens somekittens 4.0K Mar 31 18:03 images
drwxrwxr-x 13 somekittens somekittens 4.0K Mar 31 18:03 components
drwxrwxr-x  2 somekittens somekittens 4.0K Mar 31 18:03 cli
drwxrwxr-x  2 somekittens somekittens 4.0K Mar 31 18:03 cache
drwxrwxr-x 10 somekittens somekittens 4.0K Mar 31 18:03 administrator
drwxrwxr-x  5 somekittens somekittens 4.0K May 25 08:51 ..
drwxrwxr-x 17 somekittens somekittens 4.0K May 25 08:53 .
-rwxrwxr-x  1 somekittens somekittens 4.2K Mar 31 18:03 README.txt
-rwxrwxr-x  1 somekittens somekittens  18K Mar 31 18:03 LICENSE.txt
-rwxrwxr-x  1 somekittens somekittens 7.5M Mar 31 18:18 Joomla_2.5.4-Stable-Full_Package.zip

输出来自ls -lSrah(在 /var/www/ 中):

somekittens@KittensTest:/var/www$ ls -lSrah
total 7.5M
lrwxrwxrwx  1 root root   41 May 25 09:39 Joomla -> /home/somekittens/Dropbox/Project/Joomla/
drwxr-xr-x 13 root root 4.0K May 24 20:50 ..
drwxr-xr-x  2 root root 4.0K May 25 10:08 .

/etc/apache2/httpd.conf

<virtualHost indextj:80>
ServerAdmin webmaster@indextj

DocumentRoot /home/somekittens/Dropbox/Project/Joomla
<Directory />
        Options +FollowSymLinks -SymLinksIfOwnerMatch
        AllowOverride All
</Directory>

答案1

您的服务器设置为不遵循符号链接。添加此行:

Options +FollowSymLinks -SymLinksIfOwnerMatch

到你的 http.conf。更多信息:http://www.hackersgarage.com/symbolic-link-not-allowed-or-link-target-not-accessible.html

您还需要为其他人添加对每个文件夹的浏览访问权限,一直到 /home/somekittens/Dropbox/Project/Joomla/。即

sudo chmod o+x /home
sudo chmod o+x /home/somekittens
chmod o+x /home/somekittens/Dropbox
chmod o+x /home/somekittens/Dropbox/Project
chmod o+x /home/somekittens/Dropbox/Project/Joomla

相关内容