Check for existence of PHP socket availability with `nginx -t`

petecooper nginx-forum at forum.nginx.org
Sun Mar 14 15:33:02 UTC 2021


Hello.
I have some servers running PHP applications on Nginx via PHP-FPM. Each
server uses a named socket in the filesystem. Nginx can often pass its
configuration test but the server does not function as expected if the named
socket file is not there (i.e. PHP-FPM is not running as expected).

Is it possible to integrate a check for the existence of that socket file in
the `nginx -t` process? I am able to create a shell script to check for the
socket and then run `nginx -t`, but I am wondering if there is a native
route to check.

The server configs can have additional directives added outside of the
PHP-speciflc `location` blocks, if that makes it more viable.

Thank you, and best wishes.

Pete

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,290976,290976#msg-290976



More information about the nginx mailing list