Skip to content

Instantly share code, notes, and snippets.

@up9cloud
Last active April 28, 2017 06:32
Show Gist options
  • Save up9cloud/85af9c8d5f3597691fd28cb569cdbf0b to your computer and use it in GitHub Desktop.
Save up9cloud/85af9c8d5f3597691fd28cb569cdbf0b to your computer and use it in GitHub Desktop.
Docker-compose config for running wordpress with php-fpm, nginx.

Usage

docker-compose up

Folder tree

.
├── docker-compose.yml
└── nginx
    └── conf.d
        └── default.conf

Q&A

  • PATH_INFO?
    • docker-compose exec wordpress grep -rnw '/var/www/html/' -e "PATH_INFO" -C5
  • PATH_TRANSLATED?
    • docker-compose exec wordpress grep -rnw '/var/www/html/' -e "PATH_TRANSLATED" -C5

ref

server {
listen 80;
listen [::]:80;
server_name localhost;
root /var/www/html;
index index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
# rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
# Mitigate https://httpoxy.org/ vulnerabilities
fastcgi_param HTTP_PROXY "";
fastcgi_pass wordpress:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
}
version: '2'
services:
wordpress:
depends_on:
- mysql
image: wordpress:php7.1-fpm-alpine
environment:
WORDPRESS_DB_PASSWORD: admin
mysql:
image: mariadb:10
environment:
MYSQL_ROOT_PASSWORD: admin
nginx:
depends_on:
- wordpress
image: nginx:1-alpine
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
volumes_from:
- wordpress
ports:
- 8080:80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment