Nginx startup error- Failed to start The nginx HTTP and reverse proxy server

insert image description here
According to the log, the "bind() to 0.0.0.0:8888 failed (13: Permission denied)" error still occurs. This means that Nginx still cannot bind to port 8888, even with root privileges.

Please do the following to further troubleshoot the issue:

  1. Make sure that no other process is occupying port 8888 : Use the following command to check whether port 8888 is already occupied by another process:

    sudo netstat -tulnp | grep 8888
    

    If the port is already taken by another process, you need to resolve the conflict and release the port.

  2. Check SELinux status : If your system has SELinux enabled, check SELinux status and policy to see if Nginx is restricted from binding to port 8888. You can check the SELinux status by executing the following command:

    getenforce
    

    If SELinux status is Enforcing, try temporarily disabling SELinux and restarting Nginx:

    sudo setenforce 0
    sudo systemctl restart nginx
    

    If Nginx starts normally at this point, SELinux policies may be causing the problem. In this case, you need to adjust your SELinux policy to allow Nginx to bind to port 8888.

  3. Check firewall rules : Make sure firewall rules allow traffic through port 8888. You can configure firewall rules using tools such as iptablesor . ufwAlso try temporarily disabling the firewall and restarting Nginx:

    sudo systemctl stop firewalld   # 如果您的系统使用 firewalld
    # 或者
    sudo ufw disable   # 如果您的系统使用 ufw
    

    Please note that disabling the firewall will expose your system to potential security risks, please use it with caution in a production environment.

  4. Check the Nginx configuration file : Make sure that /etc/nginx/nginx.confthe listening port in the Nginx configuration file is 8888, and there are no other configuration errors.

Guess you like

Origin blog.csdn.net/weixin_53742691/article/details/132119166