Skip to content

Instantly share code, notes, and snippets.

@mhaagens
Created October 25, 2018 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhaagens/599f9e91efdb4b32952a7a06fb1b15ac to your computer and use it in GitHub Desktop.
Save mhaagens/599f9e91efdb4b32952a7a06fb1b15ac to your computer and use it in GitHub Desktop.
Docker Wordpress Development
server {
listen 80;
root /var/www/wordpress;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
#location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$ {
# expires max;
# log_not_found off;
# access_log off;
# add_header Cache-Control "public";
#}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass wordpress:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
}
version: 3.4
services:
nginx:
build:
context: ./docker/config/nginx
restart: always
ports:
- 4001:80
volumes:
- ./docker/src/wp:/var/www/wordpress
mysql:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
volumes:
- ./docker/data/mysql:/var/lib/mysql
ports:
- 3306:3306
wordpress:
image: wordpress:php7.2-fpm-alpine
restart: always
environment:
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: example
volumes:
- ./docker/src/wp:/var/www/wordpress
FROM nginx:latest
RUN echo "upstream php { server wordpress:9000; }" > /etc/nginx/conf.d/upstream.conf
COPY default.conf /etc/nginx/conf.d/default.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment