﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
1322	"nginx: [emerg] open() ""/var/run/nginx.pid"" failed (13: Permission denied)"	beerich@…		"The error (in Summary) has showed up in fresh installs of both FreeBSD 11.0-RELEASE and 11.1-RC1.  Reinstalled nginx a number of times, with no changes in the result.  It's requiring Passenger, which isn't used because this error delivers a 404 before Passenger can provide a route.  

nginx -V:
nginx version: nginx/1.12.0
built with OpenSSL 1.0.2k-freebsd  26 Jan 2017
TLS SNI support enabled
configure arguments: 
	--prefix=/usr/local/etc/nginx 
	--with-cc-opt='-I /usr/local/include' 
	--with-ld-opt='-L /usr/local/lib' 
	--conf-path=/usr/local/etc/nginx/nginx.conf 
	--sbin-path=/usr/local/sbin/nginx 
	--pid-path=/var/run/nginx.pid 
	--error-log-path=/var/log/nginx/error.log 
	--user=www 
	--group=www 
	--modules-path=/usr/local/libexec/nginx 
	--with-debug 
	--with-file-aio 
	--http-client-body-temp-path=/var/tmp/nginx/client_body_temp 
	--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp 
	--http-proxy-temp-path=/var/tmp/nginx/proxy_temp 
	--http-scgi-temp-path=/var/tmp/nginx/scgi_temp 
	--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp 
	--http-log-path=/var/log/nginx/access.log 
	--with-http_addition_module 
	--with-http_auth_request_module 
	--with-http_dav_module 
	--with-http_flv_module 
	--with-http_geoip_module=dynamic 
	--with-http_gzip_static_module 
	--with-http_gunzip_module 
	--with-http_mp4_module 
	--add-module=/usr/ports/www/nginx/work/nchan-0.99.16 
	--with-http_random_index_module 
	--with-http_realip_module 
	--with-http_secure_link_module 
	--with-http_slice_module 
	--with-http_stub_status_module 
	--with-http_sub_module 
	--add-module=/usr/ports/www/nginx/work/nginx-upload-module-72ec037 
	--with-pcre 
	--add-dynamic-module=/usr/ports/www/nginx/work/passenger-5.1.5/src/nginx_module 
	--with-http_v2_module 
	--with-stream=dynamic 
	--with-stream_ssl_module 
	--with-stream_ssl_preread_module 
	--with-threads 
	--with-mail=dynamic 
	--without-mail_imap_module 
	--without-mail_pop3_module 
	--without-mail_smtp_module 
	--with-mail_ssl_module 
	--with-http_ssl_module

uname -a:
FreeBSD neb.local 11.1-RC1 FreeBSD 11.1-RC1 #0 r320486: Fri Jun 30 02:25:16 UTC 2017     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

Clean installation.  Passenger cannot provide a route, so the whole server delivers a 404.  Error reported:

nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: [emerg] open() ""/var/run/nginx.pid"" failed (13: Permission denied)
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed

Permissions on /var/run/nginx.pid are 640.  Same error with 655.  

Same problem happened on FreeBSD 11.0-RELEASE

"	defect	closed	critical		other	1.12.x	invalid	nginx.pid		FreeBSD neb.local 11.1-RC1 FreeBSD 11.1-RC1 #0 r320486: Fri Jun 30 02:25:16 UTC 2017     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64	"nginx version: nginx/1.12.0
built with OpenSSL 1.0.2k-freebsd  26 Jan 2017
TLS SNI support enabled
configure arguments: 
	--prefix=/usr/local/etc/nginx 
	--with-cc-opt='-I /usr/local/include' 
	--with-ld-opt='-L /usr/local/lib' 
	--conf-path=/usr/local/etc/nginx/nginx.conf 
	--sbin-path=/usr/local/sbin/nginx 
	--pid-path=/var/run/nginx.pid 
	--error-log-path=/var/log/nginx/error.log 
	--user=www 
	--group=www 
	--modules-path=/usr/local/libexec/nginx 
	--with-debug 
	--with-file-aio 
	--http-client-body-temp-path=/var/tmp/nginx/client_body_temp 
	--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp 
	--http-proxy-temp-path=/var/tmp/nginx/proxy_temp 
	--http-scgi-temp-path=/var/tmp/nginx/scgi_temp 
	--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp 
	--http-log-path=/var/log/nginx/access.log 
	--with-http_addition_module 
	--with-http_auth_request_module 
	--with-http_dav_module 
	--with-http_flv_module 
	--with-http_geoip_module=dynamic 
	--with-http_gzip_static_module 
	--with-http_gunzip_module 
	--with-http_mp4_module 
	--add-module=/usr/ports/www/nginx/work/nchan-0.99.16 
	--with-http_random_index_module 
	--with-http_realip_module 
	--with-http_secure_link_module 
	--with-http_slice_module 
	--with-http_stub_status_module 
	--with-http_sub_module 
	--add-module=/usr/ports/www/nginx/work/nginx-upload-module-72ec037 
	--with-pcre 
	--add-dynamic-module=/usr/ports/www/nginx/work/passenger-5.1.5/src/nginx_module 
	--with-http_v2_module 
	--with-stream=dynamic 
	--with-stream_ssl_module 
	--with-stream_ssl_preread_module 
	--with-threads 
	--with-mail=dynamic 
	--without-mail_imap_module 
	--without-mail_pop3_module 
	--without-mail_smtp_module 
	--with-mail_ssl_module 
	--with-http_ssl_module"
