【发布时间】:2014-11-04 16:01:43
【问题描述】:
我在添加特定目录时使用默认配置,并在我的 ubuntu 12.04 机器上安装了 nginx。
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
root /username/test/static;
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
...
...
}
我只想要一个简单的静态 nginx 服务器来提供该目录中的文件。但是,检查error.log 我看到了
2014/09/10 16:55:16 [crit] 10808#0: *2 stat() "/username/test/static/index.html" failed (13: Permission denied), client:, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "domain"
2014/09/10 16:55:16 [error] 10808#0: *2 rewrite or internal redirection cycle while internally redirecting to "/index.html
我已经在/username/test/static 上完成了chown -R www-data:www-data,我已经将它们设置为chmod 755。我不知道还需要设置什么。
【问题讨论】:
-
检查
www-data用户是否可以cd到/username/test/static目录:sudo -u www-data cd /username/test/static -
我的权限被拒绝,但是当我执行 ls -l 时,它显示它设置为 www-data 用户
-
会不会是 /username 在 encryptfs 上?我的站点所在的 /home/username 文件夹遇到了完全相同的问题。如果我将其移出 encryptfs 则一切正常。对我来说仍然没有解决方案......