Today, nginx is installed in a new environment, and all accesses are 403.
Normally, 403 is displayed and I will immediately think of incorrect path configuration, but I have carefully checked the directory path:
Nginx. conf:
The code is as follows: |
Copy code |
Server { Listen 80; Server_name localhost; # Charset KOI8-R; # Access_log logs/host. access. log main; Location /{ Root/html; Index index.html index.htm; } }
|
System path query results:
The code is as follows: |
Copy code |
[Root @ lizhong html] # ll/root/html/ Total Usage 4 -Rw-r -- 1 root 3 April 18 11:07 index.html |
The directory exists. Restart nginx or this error. Then I thought about permission issues? Add a line to the nginx. conf header:
The code is as follows: |
Copy code |
User root; |
Restart nginx and then access it.
If you do not want to use the root user to run the program, you can modify the directory access permission to solve the 403 problem. However, you cannot place the directory in the root user's home directory, place it in any location, and give it 755, you can also solve the permission issue by changing the operating identity of its owner and nginx through chown.