Question

Nginx Server unable to start up due to issues with conf?

Posted November 4, 2019 19.6k views
Nginx

Last week I had setup Nginx fully and as far as I knew it was working, until I tried using gunicorn which I had no success with Gunicorn in the end. Then I noticed issues with DOSS attacks coming in and i am unsure if somethings happened to cause my Nginx sever from starting up.

I have accessed both files and they seem to be okay but the main nginx.conf under sites enabled will not save for some reason and file also appears empty?

root@ubuntu-vpc-do-moon:~# /etc/init.d/nginx status
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-11-04 10:54:44 UTC; 1min 43s ago
Docs: man:nginx(8)
Process: 2550 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Nov 04 10:54:44 ubuntu-vpc-do-moon systemd[1]: Starting A high performance web server and a reverse proxy server…
Nov 04 10:54:44 ubuntu-vpc-do-moon nginx[2550]: nginx: [emerg] open() “/etc/nginx/sites-enabled/nginx.conf” failed (2: No such file or directory) in /etc/nginx/nginx.conf:62
Nov 04 10:54:44 ubuntu-vpc-do-moon nginx[2550]: nginx: configuration file /etc/nginx/nginx.conf test failed
Nov 04 10:54:44 ubuntu-vpc-do-moon systemd[1]: nginx.service: Control process exited, code=exited status=1
Nov 04 10:54:44 ubuntu-vpc-do-moon systemd[1]: nginx.service: Failed with result ‘exit-code’.
Nov 04 10:54:44 ubuntu-vpc-do-moon systemd[1]: Failed to start A high performance web server and a reverse proxy server.

Any information would be much appreciated

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
3 answers

Go back and make sure that line 62 of the config file you’re referring to has the correct directory listed.

In my case, I had to change sites-enabled to sites-available.

In my case, my symlink is not working properly. To solve this, make sure that you write the full path of the directory when performing creating symlink with the ln -s command. Otherwise, it wouldn’t work.

Or, create a symlink from the destination directory which is in this case sites-enabled directory:

  1. cd /etc/nginx/sites-enabled
  2. ln -s ../sites-available/your-conf.conf .

And it works for me.

Hi @indigobsk,

Looking at the error log provide from nginx it seems in your /etc/nginx/nginx.conf file on line 62, there is a path/directory which doesn’t actually exist. Most probably, you’ve made a typo somewhere on the line.

I’ll recommend reviewing the file and making sure this do actually exist.

Regards,
KDSys