﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
884	NGINX 1.8.1 fails to restart depending on configuration set PIDFILE	ketheriel@…		"
Dear all,

The official RPM (Enterprise Linux 7) for NGINX provides a systemd file with the following configuration:

[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target
 
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
 
[Install]
WantedBy=multi-user.target


On many of my systems I do have the following configuration:

[root@honeypot nginx]# cat nginx.conf
user                  nginx nginx;
worker_processes      3;
pid                   /var/run/nginx.pid;
error_log             /var/log/nginx/error.log;


Since I specify /var/run/nginx.pid as the pid file (which historically is pretty much where all redhat integrated software is) is breaks NGINX as soon as I upgrade.

The service fails to start properly (actually starts and serves information, but eventually systemd will timeout and nginx process goes down again).

Is it really necessary that the systemd unit file has PID instructions? I mean this sounds a bit lame and brings problems.

Could you guys please fix this? Either by removing PIDFile stuff from the unit file or fix the code so that it validates and or either exit with error or use the pid file defined in nginx.conf and ignore the systemd crap.

This was a dreadful thing to identify/diagnose.

Thanks in advance....

Nelson Marques"	defect	closed	major		nginx-core	1.8.x	duplicate			Linux honeypot.local 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux	"nginx version: nginx/1.8.1
built by gcc 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) 
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_spdy_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'"
