Home > Article > Operation and Maintenance > What is 403nginx
The reason why nginx reports a 403 error when accessing.
1. Due to the inconsistency between the startup user and the nginx working user
Check the startup user of nginx and find that it is nobody, but the
command started with root: ps aux | grep "nginx: worker process" | awk'{print $1}'
Change the user of nginx.config to and The starting user is the same,
command: vi conf/nginx.conf
2. The index.html or index.php file is missing, which is the index index.html in the configuration file The file specified in the index.htm line.
server { listen 80; server_name localhost; index index.php index.html; root /data/www/; }
If there is no index.php or index.html under /data/www/, if you directly file the file, 403 forbidden will be reported.
3. Permission issues. If nginx does not have the permission to operate the web directory, a 403 error will also occur.
Solution: Modify the read and write permissions of the web directory, or change the startup user of nginx to the user of the directory, and restart Nginx to solve the problem
chmod -R 777 /data chmod -R 777 /data/www/
More Nginx related technical articles, Please visit the Nginx usage tutorial column to learn!
The above is the detailed content of What is 403nginx. For more information, please follow other related articles on the PHP Chinese website!