Nginx WEB access and Linux authorization constraints

You can see that all files have no permissions, even if all permissions are not available and even if nginx is configured, these are correct. Then it cannot be accessed when the browser actually accesses it.

[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

[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

  These files require read permission.

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

error log

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: 

Go to the /var/lib/nginx/tmp directory and use the command ll to check the permissions, as follows:

If there is no permission: execute: chmod -R 766 proxy/, if there is permission, no need to execute

Check the permissions of nginx as shown in the figure: the permissions are nginx and then change the nginx configuration file: user nginx;
 
change to: user root;

Then stop nginx -s stop

Restart nginx -c nginx.conf

Then I tested it and found that it was done, over! La! La!

Guess you like

Origin blog.csdn.net/qq_34556414/article/details/133276695