Setup local WordPress development environment with Docker error 500
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Source – stackoverflow.com
I need help with setting up my docker, I know there is much already configured environments but I need the one that fits my needs. Bellow you can find my setup.
docker-compose.yml
version: '3'
services:
nginx:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./wordpress:/var/www/html
- ./config/nginx:/etc/nginx/conf.d
- ./logs/nginx:/var/log/nginx
depends_on:
- phpfpm
restart: always
mariadb:
image: mariadb:latest
ports:
- "3306:3306"
volumes:
- ./data/db:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: password
restart: always
phpfpm:
image: php:fpm
ports:
- "9000:9000"
volumes:
- ./wordpress:/var/www/html
depends_on:
- mariadb
restart: always
nginx wordpress.conf
server {
listen 80;
server_name localhost;
root /var/www/html;
index index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
}
After running docker-compose up
everything works fine and I am able to navigate to 127.0.0.1 and see wordpress setup welcome page /setup-config.php
then I go to next step /setup-config.php?step=1
and after filling the form I am getting empty page. There is no error in nginx error.log, but in access.log I can see 500:
172.18.0.1 - - [24/Jun/2017:07:25:54 +0000] "POST /wp-admin/setup-config.php?step=2 HTTP/1.1" 500 5 "http://127.0.0.1/wp-admin/setup-config.php?step=1" "Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0"