I've always been using Apache with MAMP successfully, and now I need to tinker around setting up multi-stores with subdirectories in an Nginx environment.
I'm following pretty much the vanilla configurations using "TCP connection upstream fastcgi_backend". I actually don't understand what this means. Magento provides a snippet of configs like this.
upstream fastcgi_backend {
server 127.0.0.1:9000;
}
server {
listen 80;
server_name mage.dev;
set $MAGE_ROOT /var/www/magento2;
include /path/to/magento2/nginx.conf;
}
/path/to/magento2/nginx.conf
has:
location ~ (index|get|static|report|404|503)\.php$ {
fastcgi_pass fastcgi_backend;
}
However, when I try to access mage.dev
, I get a 502 bad gateway response with the following error.
*7 kevent() reported that connect() failed (61: Connection refused) while connecting to upstream
I'm reading that I need to "start php-fpm", but what does that mean? I have Nginx and MySQL started already. What else do I need to configure? Do I need to install php-fpm installed on my system separately?
Best Answer
Php-fpm is a separate service....when working with Apache the 'traditional' convention was to use mod_php, which would basically inject Php into the Apache process threads....so with that setup, you only needed to start/restart/stop Apache and everything would be good....when working with Php-fpm, the webserver handles the incoming request on port 80/443 (unless you have things in front of that...load balancer, Varnish, etc) ... but the webserver passes off this request to Php-fpm ... without Php-fpm installed your webserver, nginx in this case, won't have anything to pass the request to.
You'll need to configure Php-fpm to listen on either the socket or port...you can pull some of the configuration information from here: Digital Ocean LEMP
In regards to MAMP, I have no clue on how MAMP structures their setup.
Hope that helps.