Nginx WEB访问与Linux授权约束_html

看到所有文件的权限都是没有的,即便所有的权限都没有即使nginx做了配置,这些都是正确的。那么在浏览器真正去访问的时候是不能访问的。

Nginx WEB访问与Linux授权约束_html_02

[root@jenkins html]# ls -l
total 4
drwxr-xr-x 2 root root 23 Sep 16 17:43 dist
---------- 1 root root 33 Sep 16 17:42 index.html

Nginx WEB访问与Linux授权约束_HTTP_03

[root@jenkins html]# chmod 777 index.html 
[root@jenkins html]# ls -l
total 4
drwxr-xr-x 2 root root 23 Sep 16 17:43 dist
-rwxrwxrwx 1 root root 33 Sep 16 17:42 index.html

Nginx WEB访问与Linux授权约束_html_04

  这些文件需要读权限即可。

[root@jenkins html]# chmod +r index.html

错误日志

2023/09/25 17:15:33 [error] 3099#0: *3 open() "/usr/local/nginx/html/index.html" failed (13: Permission denied), client: 192.168.11.1, server: localhost, request: "GET / HTTP/1.1", host: "192.168.11.128"

 

 

*355 open() "/var/lib/nginx/tmp/proxy/3/07/0000000073" failed (13: Permission denied) while reading upstream, client: 127.0.0.1, server: localhost, request: "GET /dinner/images/img1.png HTTP/1.1", upstream: 

到 /var/lib/nginx/tmp 目录 用命令 ll 查看权限,如下:

如果没有权限:执行:chmod -R 766 proxy/,如果有权限,无需执行

查看nginx的权限如图:权限是nginx 然后更改nginx配置文件:user nginx;
 
改成:user root;

然后停止 nginx -s stop

重启nginx -c  nginx.conf

然后测试,发现搞定了,over! 啦!啦!啦!

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: nginxlinux