3

I'm trying to run a Wordpress project with mysql 5.5.68, Wordpress 5.7.2, Apache/2.4.6 (CentOS) and PHP 7.3.28 with Docker. The containers are up and running and I can access them but when I try to visit localhost:8000 the page doesn't load. I see This page isn't working ERR_EMPTY_RESPONSE

What do I need to add/modify to my docker-compose.yml file to get my project to run?

docker-compose.yml:

 version: '3' services: # Database db: image: mysql:5.5 volumes: - db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: password MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress networks: - wpsite # phpmyadmin phpmyadmin: depends_on: - db image: phpmyadmin/phpmyadmin restart: always ports: - '8080:80' environment: PMA_HOST: db MYSQL_ROOT_PASSWORD: password networks: - wpsite # Wordpress wordpress: depends_on: - db image: wordpress:php7.3-fpm-alpine ports: - '8000:80' restart: always volumes: ['./:/var/www/html'] environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress networks: - wpsite networks: wpsite: volumes: db_data: 
2
  • The easy solution is to use wordpress:php7.3 rather than wordpress:php7.3-fpm-alpine Commented Jun 16, 2021 at 18:52
  • @HansKilian i'm going to go with wordpress:5.7.2-php7.3-apache. Its working. Commented Jun 16, 2021 at 19:30

1 Answer 1

4

It looks like the image you are using for your core wordpress applicaiton wordpress:php7.3-fpm-alpine does not include a reverse proxy / web server to actually serve your site.

This is backed up by the documentation on the wordpress image page here: https://hub.docker.com/_/wordpress in the 'Image Varient' section you will see this comment:

wordpress:-fpm.
This variant contains PHP-FPM, which is a FastCGI implementation for PHP. See the PHP-FPM website for more information about PHP-FPM.
In order to use this image variant, some kind of reverse proxy (such as NGINX, Apache, or other tool which speaks the FastCGI protocol) will be required.

Find an image with an included Web Server / Reverse Proxy, or use a Reverse Proxy like NGINX. The link above has some liks to resources to implement this =)


Added after initial answer submission

You've specified your Apache version, but not included it within your compose setup. You'll need to add an apache container (called httpd on docker hub) and configure it with either a copied in config file, or volume mount one into the apache container.

This post has some details on the configuration you'll need to add to pass the PHP handling over to FPM: wordpress:-fpm https://stackoverflow.com/a/66234290/5889983

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! you pointed me in the right direction. I tried wordpress:5.7.2-php7.3-apache and its working.
wordpress:php7.3-fpm-alpine already contains the wordpress static files in /var/www/html. Does the reverse proxy (running on a different container) need to call the wordpress:php7.3-fpm-alpine container that has the wordpress static files?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.