Welcome! Log In Create A New Profile


nginx -t creates unnecessary nginx.pid, leading to common error

Posted by superTCP 
nginx -t creates unnecessary nginx.pid, leading to common error
November 21, 2015 10:35AM

Using nginx-1.9.7 (though I think it's always been there), I've noticed that when running "nginx -t" as root after a fresh install, results in the /run/nginx.pid file being created.

This creates a problem on the subsequent "systemctl start nginx":
Nov 20 20:50:39 localhost.localdomain nginx[557]: nginx: [emerg] open() "/run/nginx.pid" failed (13: Permission denied)

However, at the end of the above step, the PID file is removed, and so repeating "systemctl start nginx" now succeeds...

I suspect that the 1st attempt at starting fails because the nginx.pid file contains no PID (0 byte file), which is probably misinterpreted by higher software layers as a permissions problem (I have not checked the source code...)

That said, I don't see the need to create a PID file when nginx is run with -t, since the intention is just to scan the configuration, not run the daemon.

Thanks for your time.

SuperTCP for NGINX

Edited 1 time(s). Last edit at 11/21/2015 10:36AM by superTCP.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 323
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready