Report this

What is the reason for this report?

Service nginx restart fail

Posted on September 18, 2014

Hi all!

When i do " sudo service nginx restart " , terminal says me: * Restarting nginx nginx [fail]

What can i do?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

dude, thank you!

Hi, all

As some users already mentioned you should always examine the error_log in order to check what’s wrong with the configuration:

You can either tail or cat the file:

tail -f /var/log/nginx/error.log tail -n 200 /var/log/nginx/error.log cat /var/log/nginx/error.log

You can also check for any syntax errors:

sudo nginx -t

In newer OSs like CentOS 7 you can use use the journalctl command to see the logs that the journald daemon has collected.

When used alone, every journal entry that is in the system will be displayed within a pager (usually less) for you to browse. The oldest entries will be up top:

journalctl

We have an existing tutorial on how to view and manipulate systemd logs.

https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs

Hope that this helps! Regards, Alex

Your logs should indicate why that command failed. You can also use “nginx -t” to test your config for errors.

The logs are generally in /var/log/nginx

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.