Solve the Problem of Nginx 403 forbidden, nginx403
Solve the Problem of 403 forbidden in Nginx.
When configuring the static page of nginx
Server {listen 80; server_name localhost; # Some configuration content is omitted here: location/{# root html; # index index.html index.htm; root/home/myapp/; index index.html ;} # Some configuration content is omitted here}
After the configuration is complete, enable nginx and report the 403 forbidden error.
The main cause of the error is permission issues.
1. Caused by inconsistent startup users and nginx working users (for test purposes)
1. view the configuration file nginx. conf.
First line
# User nobody;
2. changed to "root", which is the user currently logged on to. If you log on with another user name, change it to the same name as the login name.
User root;
2. directory permission issues. If nginx does not have the operation permission for the web directory, the error 403 will also occur.
Solution: Modify the read and write permissions of the web directory, or change the start user of nginx to the user of the directory. Restart Nginx to solve the problem.
Chmod-R 777/data