【发布时间】:2018-10-13 00:12:09
【问题描述】:
我正在尝试将 nginx 配置为从目录提供静态文件。并在尝试访问路径 /static/ 时得到 403 Forbidden
这是我的配置中的部分内容:
user root;
<...>
http {
<...>
server {
<...>
location /static/
{
alias /home/my_user/static/;
autoindex on;
}
<...>
}
}
我还拥有/home/my_user/static/ 的 777 递归权限,是的,我在目录中有 index.html。并且仍然收到错误。为什么?
操作系统:Centos 7
【问题讨论】:
-
error.log中有什么内容? -
没什么特别的。
2018/10/12 14:39:17 [error] 23590#0: *1 open() "/home/my_user/static/index.html" failed (13: Permission denied), client: <my_ip>, server: _, request: "GET /static/index.html HTTP/1.1", host: "<my_host>"
标签: nginx nginx-config