Categories
Server Configuration

Connecting PHP to a MySQL inside a Docker container

If you ever had connection problems between PHP and a MySQL database in a Docker container, this article is for you.

I just went though this setting up this site. My linux box on AWS runs a couple of Node.js websites and I just wanted to install this WordPress site on the same server. I already had a Nginx server acting as a proxy and a MySQL server running on the server inside a Docker container so it would be very simple install php-fpm and configure another website on Nginx and use the same db server to kick off a WordPress site.