KalyanA
By:
KalyanA

Can't start nginx.

February 5, 2018 179 views
Nginx Ubuntu 16.04

Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe

2 comments
  • I suggest to try to debug in this way (just copy-paste into the console, then execute):

    printf '\n\n General: \n\n'; nginx -t ; printf '\n\n Access: \n\n' &&
    tail /var/log/nginx/access.log ; printf '\n\n Errors: \n\n' &&
    tail /var/log/nginx/error.log
    

    This is a super comfortable way to debug.

  • I got the error like 2139#2139: listen() to [::] :80, backlog 511 failed (98: Address already in use)

3 Answers

Type "nginx -t" to see what the error may be.

  • I have ran the command and I got this

    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful

You have a duplication for your server_name declaration in one or more of your files. I sometimes run into this when I copy the default.conf file and there is a sever_name _; entry in both files.

Hi guys

Thanks for the your valuable suggestions.

Here I had issue like my apache2 and nginx is running in the same port number.
I changed the apache2 port number from 80 to 8080 and it worked for me.

Have another answer? Share your knowledge.