In CentOS 7, if I put the following line in my nginx.conf:

error_log /usr/share/nginx/wordpress.itzgeek.com/logs/error.log;

I get the following error when restarting nginx:

nginx: [emerg] open() "/usr/share/nginx/wordpress.itzgeek.com/logs/access.log" failed (13: Permission denied)

user is set to 'nginx' in my nginx.conf

and I restart nginx using this command: systemctl status nginx.service Also Im logged in as root.

nginx master process is running as root and worker is running as nginx.

Any ideas? I don't understand what's wrong..

  • It's likely your selinux rules are not permitting nginx to write to your non-standard log location. I'd start by researching that. – EEAA Jan 3 '16 at 13:12
  • Is the standard log location '/var/log/nginx/' ? – ctrlz Jan 3 '16 at 13:14
  • Yes............... – EEAA Jan 3 '16 at 13:16
  • I dont remember having this issue with centos 6.5 – ctrlz Jan 3 '16 at 13:18
  • Perhaps selinux was configured differently or was not active. Don't rely on your memory. Check the data that is available to you. – EEAA Jan 3 '16 at 13:23

Like the log message said it's likely a permissions problem. Change it to a location that nginx can write to, something like this

error_log /var/log/nginx/wordpress.itzgeek.com/error.log;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.