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!
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.
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.