Error nginx does not want to start

(Comments)

Today I had a very very annoying and confusing situation. Which was a doesn't work host! And it's terrible. 

Here how it looked like. 

And it means the error is in my side. So I go to the site and try to turn off 

1. My Gunicorn 

2. My Nginx

And it turns out that my Nginx that does not work. 

I found it by typing 

service nginx status

or

journalctl -xe

And it always give me error that 

[email protected]:~$ journalctl -xe
Hint: You are currently not seeing messages from other users and the system.
Users in the 'systemd-journal' group can see all messages. Pass -q to
turn off this notice.
No journal files were opened due to insufficient permissions.


and it made me more worried because nothing it seems wrong

[email protected]:~$ service nginx stop
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to stop 'nginx.service'.
Authenticating as: ,,, (django)
Password:
==== AUTHENTICATION COMPLETE ===
[email protected]:~$ killall -9 nginx
nginx: no process found
[email protected]:~$ service nginx start
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'nginx.service'.
Authenticating as: ,,, (django)
Password:
==== AUTHENTICATION COMPLETE ===
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
[email protected]:~$ systemctl status nginx.service
● 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 Wed 2019-05-22 19:49:12 UTC; 15s ago
Process: 7504 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

and it still does not show anything

The situation is getting more weird because the system does not show the exact location about where is the error. And it gives me another Paulo Coelho moment where the programmer mostly spend 90% of his time actually not in programming, but in debugging. Especially debugging something that usually works but then why the hell it doesnt work now. 

And then I found some hint.

I login as a root and do the test to turn on the nginx again

[email protected]:~# systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
[email protected]:~# service nginx quit
Usage: nginx {start|stop|restart|reload|force-reload|status|configtest|rotate|upgrade}
[email protected]:~# service nginx stop
[email protected]:~# systemctl start nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
[email protected]:~# nginx -t
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
2019/05/22 19:52:09 [emerg] 7679#7679: open() "/var/log/nginx/access.log" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed

And whalla 

The isue it turned out because I dont have the log for nginx. 

So the solution was creating the log

[email protected]:~# cd /var/log
[email protected]:/var/log# mkdir nginx
[email protected]:/var/log# sudo chown -R www-data:www-data /var/log/nginx;
[email protected]:/var/log# sudo chmod -R 755 /var/log/nginx;
[email protected]:/var/log# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[email protected]:/var/log# systemctl start nginx
[email protected]:/var/log#

And thanks to this site that helps me find out the solution. 

And whalla the site lives again!

Currently unrated

Comments

Riddles

22nd Jul- 2020, by: Editor in Chief
524 Shares 4 Comments
Generic placeholder image
20 Oct- 2019, by: Editor in Chief
524 Shares 4 Comments
Generic placeholder image
20Aug- 2019, by: Editor in Chief
524 Shares 4 Comments
10Aug- 2019, by: Editor in Chief
424 Shares 4 Comments
Generic placeholder image
10Aug- 2015, by: Editor in Chief
424 Shares 4 Comments

More News  »

This whole VLOG is made in LUmix S5 and 24 mm 1.8

Recent news

Enjoy

read more
1 month, 4 weeks ago

How to take F-Log XT-3 to davinci resolve

Recent news
1 month, 4 weeks ago

The chart of aspect ratio resolution

Recent news

Aspect Ratio Cheat Sheet

Below are some common aspect ratios and their pixel resolutions. Always confirm your final delivery ratio when shooting.
If you think there should be an addition or correction, .

read more
1 month, 4 weeks ago

How to change your icon in firefox and chrome

Recent news

If you use the bookmarks bar on Google Chrome or Firefox, sometimes space is at a minimum. When you bookmark a site, it includes the site’s icon and the text description about the site. That is shortened when the icon is added to the bookmarks bar, but not completely.

read more
3 months, 1 week ago

I try the audio sync feature from Davinci and its amazing

Recent news

So last night, finally I have a time to use a feature of Sound sync that is available in the Davinci Resolve! 

read more
5 months ago

The most popular short video in channel Bricky train and Lets Macro it

Recent news

This short video of my youtube of Lego in Balcony has been the most popular YT in the channel. 

read more
5 months ago

Will we ever know Ouamuamua, the first traveler in interstellar

Recent news
5 months, 1 week ago

Bila Jupiter terdiri Dari gas apakah bila Kita menyalakan API visa meledak

Recent news

Jawabannya adalah tidak. Karena Di Jupiter tidak Ada olsigen

read more
5 months, 2 weeks ago

More News »

Generic placeholder image

Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without