Nginx - Everything is ok / successful

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/” failed (13: Permission denied) nginx: configuration file /etc/nginx/nginx.conf test failed

Any thoughts?

Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.