Nginx fails to start under linux, several error handling for Nginx startup failure

nginx failed to start

Failed to start nginx, the error message is as follows:

Starting nginx: nginx: [emerg] bind() to 0.0.0.0:**** failed (13: Permission denied)

This is usually because SELinux is enabled. Use the command getenforce to view the SELinux status. If the output is enforcing, it means it is enabled. Close with:

temporarily shut down selinux

shut down selinux permanently

Modify the /etc/selinux/config file

Change SELINUX=enforcing to SELINUX=disabled

Just restart the machine

403 Forbidden error

After nginx is configured, a 403 Forbidden error occurs when accessing the page. You can check the error log to determine the cause of the problem. The error log file name is specified in the /usr/nginx/conf/nginx.conf file, the default is /var/log/nginx/error.log, use the command

 PS: The interface after it has been resolved

Check, if you find information similar to index.html failed (13: Permission denied), it is usually the reason why the user permissions of nginx and the user permissions of the website directory file are inconsistent (because the user of the website directory file is usually xxx or root, and nginx The default working process user is nginx, which can be modified in nginx/conf/nginx.conf), my solution is not to modify nginx.conf, but to log in as root user, and put the website directory file in /usr/ local/conf/nginx/xxx (to ensure that the user of all files is root), and then restart nginx, you can access normally.

Guess you like

Origin blog.csdn.net/weixin_59539033/article/details/127747004