无论我怎么尝试,我似乎都无法在我的 Apache VirtualHost 中获得有效的符号链接,并且在错误日志中看到以下错误:
Symbolic link not allowed or link target not accessible: /var/www/carddesigner
我可以从 Linux 浏览实际的符号链接,没有任何问题:
$ ls -l /var/www | grep "carddesigner"
lrwxrwxrwx 1 rfkrocktk rfkrocktk 64 2011-02-28 16:52 carddesigner -> /home/rfkrocktk/Documents/Projects/Work/carddesigner/build/main/
此外,我已确保我的 VirtualHost 允许 FollowSymLinks 选项:
在 /etc/apache2/sites-enabled/000-本地主机:
<VirtualHost 127.0.0.1:80>
ServerAdmin ##########
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Deny from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
RewriteEngine On
RewriteLog "/var/log/apache2/mod_rewrite.log"
RewriteLogLevel 9
</VirtualHost>
我似乎找不到任何其他配置文件来覆盖此设置和/或阻止加载符号链接。有什么想法吗?
以下是我对实际引用文件的权限:
$ ls -l ~/Documents/Projects/Work/carddesigner/build/main
total 12
drwxrwxrwx 5 rfkrocktk rfkrocktk 4096 2011-02-28 16:11 advanced
drwxrwxrwx 2 rfkrocktk rfkrocktk 4096 2011-02-28 16:10 core
drwxrwxrwx 2 rfkrocktk rfkrocktk 4096 2011-02-28 16:10 simple
看起来权限已经准备好了,对吗?
答案1
中文档的文件权限是什么/home/rfkrocktk/Documents/Projects/Work/carddesigner/build/main
?它们也必须可被 Web 服务器读取,而不仅仅是符号链接。
答案2
ls -Z /pat/to/www
drwxr-xr-x. root root unconfined_u:object_r:httpd_sys_content_t:s0 www
chcon -Rv --type=httpd_sys_content_t /pat/to/www