I deleted the /var/log/nginx/error.log file, and then created a new one using:
sudo nano error.log
Doing ls -la
shows that the error.log and access.log have the same permissions.
When I try and start nginx I get the error:
alert: could not open error log file: open()
"/var/log/nginx/error.log" failed permission denited.
Update
When trying to start nginx, I am also seeing:
emerg: /var/run/nginx.pid failed 13: permission denied.
Best Answer
This doesn't solve your problem, but in the future, if you do
you will copy over the contents of the file with nothing, and keep all permissions in tact.
Not nginx-speicific, but Additionally, make sure you are running the application as the user it is supposed to run as. If you ever ran it as root, all the permissions are going to be owned by root, so other users won't be able to run it.