stat() "/root/xxx/index.html" failed (13: Permission denied)

前言

nginx 上部署静态网页报502,于是查看 nginx 错误日志 error_log /var/log/nginx/error.log;,却没有看到任何错误信息;访问 nginx活动日志 access_log /var/log/nginx/access.log; 时发现 stat() "/root/xxx/index.html" failed (13: Permission denied),权限不足。

解决

第一步,将静态网页权限改为可读可执行,chmod -R 755 ,(文件所有者可读可写可执行,用户组可读可执行,其他用户可读可执行)

发现还是不行,报错日志还是没变

第二步查看 nginx 配置文件,看到 user nobody使用用户,修改为当前登录帐号用户名,例如:user root,(不建议使用超级管理员)

重启 nginxnginx -s reload

成功!

posted @ 2022-12-05 09:16  牛奔  阅读(343)  评论(0编辑  收藏  举报