On my server I run multiple independent sites (since none are too resource intensive, it makes no sense to rent a server for each). After recently discovering and finally learning Docker I discovered how immensely useful it is, especially how much it can help me as a systems administer. I have begun moving all of the sites into independent NGINX docker containers to serve their sites, with a gateway NGINX container in a bridge network with all of them exposing it's ports to allow for external connections. It can then route connections using the IPs the containers have inside the virtual network.

The only issue issue is now deploying PHP for the websites. As I had it before (before I made myself finally learn Docker), I am attempting to use a single PHP instance for all of the containers. It appears, however, that this isn't as easy as I initially believed. NGINX doesn't actually pass the field to the PHP-FPM instance, which is where I run into troubles. Having to modify the configuration of the PHP instances to use some sneaky work arounds having NGINX append to the beginning of the path to use a connected volume might work, however, it defeats a lot of the purpose.

I'd assume there is some configuration where I can deploy a solution like the one I am thinking of, however I haven't been able to find any. One of the main reasons for wanting a singular deployed instance is ease of administration. Along with that, my intent was to have a single container per domain, since that also makes administering and allowing access to them easier. Plus, more containers means more IPs to keep track of inside of the bridge network.

Thanks for any help in advanced. I'm hoping there's some easy solution to this. Hopefully I can deploy a single shared PHP instance, just like I'm deploying a single shared MySQL instance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.