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:
But, when I do sudo service nginx restart I get:
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!
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.
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.