nginx 报错is forbidden (13: Permission denied), client: 192.168.44.1, server: localhost, request: “GET / HTTP/1.1”, host: “192.16

内容纲要

报错描述

nginx 报错is forbidden (13: Permission denied), client: 192.168.44.1, server: localhost, request: "GET / HTTP/1.1", host: "192.16...

原因

查看/usr/local/nginx/logs/error.log,可以看到日志

2023/01/05 14:22:58 [error] 117856#0: *2 "/root/.../web/dist/index.html" is forbidden (13: Permission denied), client: 192.168.44.1, server: localhost, request: "GET / HTTP/1.1", host: "192.168.44.101"

无权限问题。

解决办法

查看nginx进程 ps -ef|grep nginx

发现有一行进程显示nobody,说明nginx安装后,配置文件没有指定user

使用vim打开nginx.conf配置文件
vim /usr/local/nginx/conf/nginx.conf

搜索user /user

添加一行 user root

保存退出

重新加载nginx配置
service nginx reload

或者重启nginx
systemctl stop nginx
systemctl start nginx

问题解决。

Leave a Comment

您的电子邮箱地址不会被公开。 必填项已用*标注

close
arrow_upward