Report this

What is the reason for this report?

Nginx - Everything is ok / successful

Posted on April 30, 2016

Hello, When I do sudo nginx -t, I get told this: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

But, when I do service nginx restart I get:

  • Restarting nginx nginx [fail]

But, when I do sudo service nginx restart I get:

  • Restarting nginx nginx [ OK ]

Lastly, if I do niginx -t without “sudo” I get: nginx: [alert] could not open error log file: open() “/var/log/nginx/error.log” failed (13: Permission denied) 2016/04/30 12:11:48 [warn] 16918#0: the “user” directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 2016/04/30 12:11:48 [emerg] 16918#0: open() “/run/nginx.pid” failed (13: Permission denied) nginx: configuration file /etc/nginx/nginx.conf test failed

Any thoughts?



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.

Answer by user Artelis:

Everything’s fine there. For security reasons, everything under /var/log/nginx/ (or /var/log/apache2/ if you use Apache instead) is owned by root and can’t be touched by any other user. Hence the “sudo” requirement.

There’s nothing wrong with your configuration.

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.