On a Fedora 16 build I get the following in the logs:
Dec 30 05:27:47 localhost nginx[10515]: Starting nginx: [ OK ]
Dec 30 05:27:47 localhost systemd[1]: Failed to read PID file /usr/local/nginx/logs/nginx.pid after start. The service might be broken.
Dec 30 05:27:53 localhost nginx[10546]: nginx: the configuration file /etc/nginx/conf.d/nginx.conf syntax is ok
Dec 30 05:27:53 localhost nginx[10546]: nginx: configuration file /etc/nginx/conf.d/nginx.conf test is successful
Dec 30 05:27:53 localhost nginx[10546]: Reloading nginx: [ OK ]
Dec 30 05:27:53 localhost systemd[1]: Failed to read PID file /usr/local/nginx/logs/nginx.pid after reload. The service might be broken.
Version is:
05:28 AM /usr/src/nginx-1.1.12# /usr/sbin/nginx -V
nginx version: nginx/1.1.12
built by gcc 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/var/www --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/conf.d/nginx.conf --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --error-log-path=/var/log/nginx/errors.log --http-log-path=/var/log/nginx/access.log ...etc.
LL also shows the pid in the wrong directory in /var/run:
05:29 AM /var/run # ll |grep nginx
drwxr-xr-x. 2 root root 40 Dec 30 05:10 nginx
-rw-r--r--. 1 root root 6 Dec 30 05:29 nginx.pid
Since Fedora is switching over to systemctl, here are some useful links:
http://0pointer.de/blog/projects/systemd-for-admins-3.html
https://kezhong.wordpress.com/2011/11/19/creating-my-own-systemd-service-files-on-fedora-16x86_64/
https://fedoraproject.org/wiki/Packaging:Systemd
http://0pointer.de/blog/projects/systemd-docs.html
In order to create service files, do the following:
# cd /lib/systemd/system
# nano nginx.service
paste:
[Unit]
Description=Nginx - a high performance http(s) server
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
[Install]
WantedBy=multi-user.target
...save and exit, then:
#cd /etc/systemd/system/multi-user.target.wants
#ln -s /lib/systemd/system/nginx.service nginx.service
#systemctl --system daemon-reload
...and systemctl enable nginx.service if desired.
System administrator link is here: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet
Even after using systemctl service files, the pid file remains in /var/run and not in /var/run/nginx as specified with ./configure but the error message disappears. Minor issues which can be solved in future releases.