Nginx静态文件403禁止
我正在尝试将nginx配置为服务于目录中的静态文件。在尝试访问路径/静态时禁止使用403/ 以下是我的配置中的部分:Nginx静态文件403禁止,nginx,nginx-config,Nginx,Nginx Config,我正在尝试将nginx配置为服务于目录中的静态文件。在尝试访问路径/静态时禁止使用403/ 以下是我的配置中的部分: user root; <...> http { <...> server { <...> location /static/ { alias /home/my_user/static/; autoindex on; }
user root;
<...>
http {
<...>
server {
<...>
location /static/
{
alias /home/my_user/static/;
autoindex on;
}
<...>
}
}
用户根目录;
http{
服务器{
位置/静态/
{
别名/home/my_user/static/;
自动索引;
}
}
}
我还拥有/home/my_user/static/
的777递归权限,是的,我在目录中有index.html。而且还是会出错。为什么?
操作系统:Centos 7启用标志
/usr/sbin/setsebool -P httpd_read_user_content true
解决了这个问题
Thx到错误日志中有什么?没有什么特别的<代码>2018/10/12 14:39:17[错误]23590#0:*1 open()“/home/my_user/static/index.html”失败(13:权限被拒绝),客户端:,服务器:",请求:“GET/static/index.html HTTP/1.1”,主机:“