Nginx: Job for nginx.service failed because the control process exited

前端 未结 19 1067
予麋鹿
予麋鹿 2021-01-29 19:31

I got a problem which I have been trying to fix for a few days now and I don\'t know what to do, have been looking for answers but all of those I found didn\'t help me.

相关标签:
19条回答
  • 2021-01-29 19:55

    May come in handy to check syntax of Nginx's configuration files by running:

    nginx -t -c /etc/nginx/nginx.conf
    
    0 讨论(0)
  • 2021-01-29 19:55

    I had the same problem when I used Vesta, which uses nginx with apache. The problem was that after applying all updates Apache started listening to 443 for https. The solution was just to comment out the 443 stuff in ports.conf. This is because nginx also uses this port.

    0 讨论(0)
  • 2021-01-29 19:57

    Had this issue when provisioning a new site for VVV in vvv-config.yml with a faulty syntax, vagrant up would throw the error. Deleting and reverting to old configuration, running vagrant provision helped

    0 讨论(0)
  • 2021-01-29 19:58

    When something cannot bind to a port, it's 5% because it's not started by root (sticky suid bit, sudo) and 94% because another application is already bound to that port.

    Make sure nginx is really shutdown and you don't try to start it twice by accident.

    Make sure you don't have Apache or other services running that use port 80.

    Utilize netstat -a | grep tcp to find out more.

    0 讨论(0)
  • 2021-01-29 19:58

    This worked for me:

    First, go to

    cd /etc/nginx

    and make the changes in nginx.conf and make the default port to listen from 80 to any of your choice 85 or something.

    Then use this command to bind that port type for nginx to use it:

    semanage port -a -t PORT_TYPE -p tcp 85

    where PORT_TYPE is one of the following: http_cache_port_t, http_port_t, jboss_management_port_t, jboss_messaging_port_t, ntop_port_t, puppet_port_t.

    Then run:

    sudo systemctl start nginx; #sudo systemctl status nginx

    [you should see active status]; #sudo systemctl enable nginx

    0 讨论(0)
  • 2021-01-29 20:00

    Try to debug with command:

    $ service nginx configtest
    

    Which outputs something like:

    Testing nginx configuration: nginx: [emerg] unknown directive "stub_status" in /etc/nginx/sites-enabled/nginx_status:11
    nginx: configuration file /etc/nginx/nginx.conf test failed
    

    And fix those warnings

    Then restart nginx

    0 讨论(0)
提交回复
热议问题