【发布时间】:2011-04-25 10:21:04
【问题描述】:
我已经在 Ubuntu10.10 上设置了 nginx 0.7.67 和 php-cli 。我正在尝试运行基于前端控制器的 PHP 框架,但除 index.php 之外的所有页面都会出现 403 错误。
例如:
- http://mysite.com/styles/style.css - 403 禁止
- http://mysite.com/scripts/script.css - 403 禁止
- http://mysite.com/index.php - 工作
我的/etc/nginx/sites-enabled/default如下
server {
listen 80;
server_name mysite.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
index index.php index.html;
root /full/path/to/public_html;
location ~* \.(js|css|png|jpg|jpeg|gif|ico|html)$ {
expires max;
}
location ~ index.php {
include /etc/nginx/fastcgi_params;
keepalive_timeout 0;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
}
关于如何解决上述问题的任何建议?
PS:这是错误日志中的条目
2010/10/14 19:56:15 [error] 3284#0: *1 open() "/full/path/to/public_html/styles/style.css"
failed (13: Permission denied), client: 127.0.0.2, server: quickstart.local,
request: "GET /styles/style.css HTTP/1.1", host: "mysite"
【问题讨论】:
-
该死的。这是Linux权限问题。顶级目录之一没有其他人的“r”权限。问题已解决。
-
同意。我只是将所有文件的权限更改为 755,并将 www-data 设为文件夹的所有者,一切都开始工作了。
标签: regex nginx http-status-code-403