pkaramol
pkaramol

Reputation: 19372

Nginx permission denied (for default user) on /var/log/nginx

I am installing nginx from source via the folllowing command:

./configure --sbin-path=/usr/bin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-debug --with-pcre \
    --with-http_ssl_module \
    && make \
    && make install

The user entry in /etc/nginx/nginx.conf is commented out:

#user  nobody;

When trying to start nginx via command line just by typing nginx I get the following error:

nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2017/11/03 14:57:08 [emerg] 17427#0: mkdir() "/usr/local/nginx/client_body_temp" failed (13: Permission denied)

I assume the second error relates to the process of creating the .pid file under /usr/local/nginx... (?)

There is no nginx user in /etc/passwd.

  1. As what user the nginx process is starting?
  2. Do I need to manually change anything regarding permissions / ownership under /var/log after installation via source code?

Working on debian jessie with nginx 1.13.6

Upvotes: 1

Views: 4887

Answers (1)

Michał Mazur
Michał Mazur

Reputation: 125

I had the same error when I executed command nginx -t. I solved using sudo nginx -t

Upvotes: 2

Related Questions