I'm having some trouble conceptually with an Nginx configuration. Starting with an
nginx SSL-terminator reverse-proxy, I use a
docker-compose.yml setup with a few containers, each providing a virtual service. These services are provided as subdirs under a single hostname:
net --443--> nginx | | `--- ContainerA "https://example.com/serviceA/" | `----- ContainerB "https://example.com/serviceB/" `------- ContainerC "https://example.com/serviceC/"
Snippets of process lists:
nginx:~$ ps fax 127285 ? Ss 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf -g daemon off; 127419 ? S 0:00 \_ nginx: worker process 127420 ? S 0:00 \_ nginx: worker process 127421 ? S 0:00 \_ nginx: worker process ContainerA:~$ ps fax 127132 ? Ss 0:09 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf) 234053 ? S 8:27 \_ php-fpm: pool www 236952 ? S 8:12 \_ php-fpm: pool www 259123 ? S 6:42 \_ php-fpm: pool www
I thought there would be efficiency gained by running a single instance of
nginx, and using
php-fpm in each of the containers.
I think that the premise of
php-fpm is such that the containers do not need their own
nginx processes; the
nginx processes communicates with each container over port 9000 (the network part works). In practice, though, I'm having trouble, so I need to verify that my premise is sound:
Is this assumption of a basic
php-fpm architecture correct? Alternatively, is a proper
php-fpm infrastructure intended to use
php-fpm in direct concert (same host and filesystem) or is multi-hosting/multi-filesystem reasonable and efficient?
(I recently reached out to contract some help, and their first response was "you need to run
nginx in each container", which didn't make sense to my understanding of
(There are plenty of questions here that ask specific
nginx.conf questions, not about this admittedly higher-level architecture.)