Nginx: Permission denied for nginx on Ubuntu Nginx: Permission denied for nginx on Ubuntu nginx nginx

Nginx: Permission denied for nginx on Ubuntu


Make sure you are running the test as a superuser.

sudo nginx -t

Or the test wont have all the permissions needed to complete the test properly.


If i assume that your second code is the puppet config then i have a logical explaination, if the error and log files were create before, you can try this

sudo chown -R www-data:www-data /var/log/nginx;sudo chmod -R 755 /var/log/nginx;


I faced similar issue while restarting Nginx and found it to be a cause of SeLinux. Be sure to give a try after either disabling SeLinux or temporarily setting it to Permissive mode using below command:

setenforce 0

I hope it helps :)