Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#1583 closed defect (duplicate)

nginx cannot run as a regular user

Reported by: ijt@… Owned by:
Priority: minor Milestone:
Component: other Version: 1.15.x
Keywords: Cc:
uname -a: Linux issactrotts2.sfo.corp.google.com 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.13.7
built with OpenSSL 1.1.0g 2 Nov 2017
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/tmpfs/tmp/build-debs.LBeFmI/nginx-1.13.7=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail=dynamic --with-mail_ssl_module --add-dynamic-module=/tmpfs/tmp/build-debs.LBeFmI/nginx-1.13.7/debian/modules/http-auth-pam --add-dynamic-module=/tmpfs/tmp/build-debs.LBeFmI/nginx-1.13.7/debian/modules/http-dav-ext --add-dynamic-module=/tmpfs/tmp/build-debs.LBeFmI/nginx-1.13.7/debian/modules/http-echo --add-dynamic-module=/tmpfs/tmp/build-debs.LBeFmI/nginx-1.13.7/debian/modules/http-upstream-fair --add-dynamic-module=/tmpfs/tmp/build-debs.LBeFmI/nginx-1.13.7/debian/modules/http-subs-filter

Description

nginx insists on opening files that it has been told not to open, and these files cannot be accessed by a regular user.

$ cat nginx.conf
error_log off;
access_log off;

$ nginx -c nginx.conf
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2018/06/25 11:30:03 [emerg] 100093#100093: open() "/usr/share/nginx/nginx.conf" failed (2: No such file or directory)

It seems like an unnecessary limitation.

Change History (2)

comment:1 by Ruslan Ermilov, 7 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #147.

comment:2 by Ruslan Ermilov, 7 years ago

This is controversial, but please also note that a non-absolute argument to -c will prepend the path value from the --prefix= configure option (/usr/share/nginx/ in your case); to use nginx.conf from the current directory, specify it as an absolute pathname.

Note: See TracTickets for help on using tickets.