Today in a new environment to install NGINX, the results are accessed by 403
Usually show 403 I immediately think of the path configuration is wrong, but I looked carefully, the directory path is no problem:
Nginx.conf:
Copy Code code as follows:
server {
Listen 80;
server_name localhost;
#charset Koi8-r;
#access_log Logs/host.access.log Main;
Location/{
root/root/html;
Index index.html index.htm;
}
}
Path query results in the system:
Copy Code code as follows:
[Root@lizhong html]# ll/root/html/
Total Dosage 4
-rw-r--r--1 root root 3 April 11:07 index.html
Directory, restart Nginx or this error, later thought is not a permission issue? Then add a line to the nginx.conf head:
Copy Code code as follows:
Restart Nginx, and then you can access it normally.
Restart Nginx, and then you can access it normally.
If you do not want to run with root, you can resolve the 403 problem by modifying directory access, but you cannot place the directory in the root user host directory, place it in any location and give it 755, or change its owner and Nginx by Chown to resolve permissions issues.