Closed dougthor42 closed 6 years ago
Sorry about that! I didn't document it well. Create a file at /etc/nginx/conf.d/php.conf
with something like this in it:
upstream php {
server unix:/run/php/php7.2-fpm.sock;
}
Assuming your PHP-FPM UNIX socket is at /run/php/php7.2-fpm.sock
(this is configured in your PHP-FPM config, eg. /etc/php/7.2/fpm/pool.d/www.conf
by default on Debian)
Configuring the upstream like this lets you do fastcgi_pass php
in a website's Nginx config, rather than spreading an implementation detail (the exact path to the UNIX socket) throughout every website config on your server.
The alternative is to hard-code the path directly in the site's config, but this is usually not recommended:
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
Perfect, thanks! That's definitely good documentation (normally I'm an Apache user, but even then I only know the very basics and enough to harden the server...).
I'm having some trouble setting this up. I'm not familiar with nginx at all, sadly, so it's definitely on me.
In the readme, you have this line:
Can you expand on that a bit? Which instance of "php" do I change? It shows up 15 times in the example nginx file.
If I ignore that change and attempt to start nginx, I get a
no port in upstream "php"
error: