Skip to content

Instantly share code, notes, and snippets.

@udienz
Last active August 5, 2016 01:49
Show Gist options
  • Save udienz/c6656956a58220db761662787c768c7e to your computer and use it in GitHub Desktop.
Save udienz/c6656956a58220db761662787c768c7e to your computer and use it in GitHub Desktop.
build wordpress with docker (manual way)
version: '2'
services:
web:
container_name: web
image: nginx:latest
ports:
- "9081:80"
volumes:
- ./code:/code
- ./site.conf:/etc/nginx/conf.d/default.conf
links:
- php
- db
php:
container_name: php
image: php:5-fpm
volumes:
- ./code:/code
db:
container_name: db
image: mariadb:latest
environment:
- MYSQL_ROOT_PASSWORD=wcqXV31UndM5yMT
- MYSQL_DATABASE=0Zykrq3Lq64cmX3
- MYSQL_PASSWORD=wY7Ig2uGrIqe4MI
- MYSQL_USER=pjd1AD5dfIGRE7p
phpmyadmin:
container_name: phpmyadmin
image: phpmyadmin/phpmyadmin
ports:
- "9082:80"
links:
- db
server {
listen 80;
server_name _default_;
root /code;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
expires 30d;
}
location ~ \.php$ {
try_files $uri /index.php;
fastcgi_pass php:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off;
log_not_found off;
expires max;
}
location = /robots.txt {
access_log off;
log_not_found off;
}
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
}
location ~* \.(?:rss|atom)$ {
expires 1h;
}
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location ~* ^/wp-content/uploads/.*.(html|htm|shtml|php|js|swf)$ {
deny all;
}
location ~* wp-config.php {
deny all;
}
location ~* /\.(?!well-known\/) {
deny all;
}
location ~* (?:\.(?:bak|conf|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$ {
deny all;
}
set_real_ip_from 127.0.0.0/8;
set_real_ip_from 10.0.0.0/8;
real_ip_header X-Real-IP;
add_header "X-UA-Compatible" "IE=Edge";
aio threads;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header "Cache-Control" "no-transform";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment