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

petecooper nginx-forum at
Mon Mar 15 06:23:38 UTC 2021

Hello Maxim.

> nginx does not care if the upstream socket is reacheable or not 
> when it parses configuration, it is only important when processing 
> a particular request.  That is, nginx can (and will) start just 
> fine if the socket doesn't exist (or, similarly, upstream server's 
> IP address isn't reachable).  And that's what "nginx -t" 
> checks for: if nginx itself will be able to start.
> […] 
> If your use case is simple enough and you want both nginx and 
> corresponding PHP-FPM processes to be running at the same time, 
> and, for example, don't want to start nginx if PHP-FPM isn't 
> running - this is something to check by means external to nginx.

Perfect answer - thank you very much for your clarification.

With gratitude and best wishes,


Posted at Nginx Forum:,290976,290985#msg-290985

More information about the nginx mailing list