0

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..

6
  • 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
    Commented Jan 3, 2016 at 13:12
  • Is the standard log location '/var/log/nginx/' ?
    – ctrlz
    Commented Jan 3, 2016 at 13:14
  • Yes...............
    – EEAA
    Commented Jan 3, 2016 at 13:16
  • I dont remember having this issue with centos 6.5
    – ctrlz
    Commented Jan 3, 2016 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
    Commented Jan 3, 2016 at 13:23

1 Answer 1

0

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;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .