From aa8045a55de1726f6b62661b7cdb7a626741f7d3 Mon Sep 17 00:00:00 2001 From: Siroco Date: Thu, 21 May 2020 12:49:20 +0200 Subject: [PATCH] First commit. Test version --- docker-compose.yml | 36 +++++++++++++++++++ mariadb/Dockerfile | 10 ++++++ nginx/Dockerfile | 16 +++++++++ nginx/sd.conf | 80 ++++++++++++++++++++++++++++++++++++++++++ php-fpm/Dockerfile | 28 +++++++++++++++ php-fpm/wordpress.conf | 16 +++++++++ php-fpm/wp-config.php | 0 7 files changed, 186 insertions(+) create mode 100644 docker-compose.yml create mode 100644 mariadb/Dockerfile create mode 100644 nginx/Dockerfile create mode 100644 nginx/sd.conf create mode 100644 php-fpm/Dockerfile create mode 100644 php-fpm/wordpress.conf create mode 100644 php-fpm/wp-config.php diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..df2ec48 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,36 @@ +version: '3' + +services: + + nginx: + build: "./nginx/" + container_name: sd_wp_nginx + restart: always + links: + - php-fpm:wp + ports: + - "80:80" + - "443:443" + volumes: + - sd-wp-data:/var/www/html + + php-fpm: + build: "./php-fpm/" + container_name: sd_wp_php + restart: always + links: + - mariadb:db + depends_on: + - mariadb + volumes: + - sd-wp-data:/sindominio/wordpress + + mariadb: + build: "./mariadb/" + container_name: sd_wp_db + restart: always + volumes: + - sd-wp-db:/var/lib/mysql +volumes: + sd-wp-data: + sd-wp-db: diff --git a/mariadb/Dockerfile b/mariadb/Dockerfile new file mode 100644 index 0000000..114a4e9 --- /dev/null +++ b/mariadb/Dockerfile @@ -0,0 +1,10 @@ +FROM registry.sindominio.net/debian + +RUN apt-get update && \ + apt-get -qy install mariadb-server &&\ + apt-get clean + +VOLUME /var/lib/mysql + +CMD ["/usr/bin/mysqld_safe"]] + diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000..cd58a09 --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,16 @@ +FROM registry.sindominio.net/debian + +RUN apt-get update && \ + apt-get -qy install nginx-full &&\ + apt-get clean + +COPY sd.conf /etc/nginx/sites-available/sd.conf +RUN rm /etc/nginx/sites-enabled/default +RUN ln -s /etc/nginx/sites-available/sd.conf /etc/nginx/sites-enabled/sd.conf + +VOLUME /var/www/html + +EXPOSE 443 +EXPOSE 80 + +CMD /usr/sbin/nginx -g "daemon off; master_process off;" diff --git a/nginx/sd.conf b/nginx/sd.conf new file mode 100644 index 0000000..2b947bf --- /dev/null +++ b/nginx/sd.conf @@ -0,0 +1,80 @@ +# WordPress multisite subdirectory rules. + +map $uri $blogname{ + ~^(?P/[^/]+/)files/(.*) $blogpath ; +} + +map $blogname $blogid{ + default -999; +} + +server { + listen 23080; + listen [::]:23080; + + server_name _default_; + server_name wp.sindominio.net; + server_name yyvaclqpmkx22jraecxtv5bt5ukqkjmygvhw2wk3ee5zl7jkavhs7rid.onion; + server_name sindominio.net; + + root /var/www/html; + index index.php; + + client_max_body_size 25M; + + location = /favicon.ico { + log_not_found off; + access_log off; + } + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + location ~ /\. { + deny all; + } + + location ~* /(?:uploads|files)/.*\.php$ { + deny all; + } + + location ~ ^(/[^/]+/)?files/(.+) { + try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2 ; + access_log off; + log_not_found off; expires max; + } + + location ^~ /blogs.dir { + internal; + alias /home/htdocs/wordpress/stable/wp-content/blogs.dir ; + access_log off; + log_not_found off; expires max; + } + + if (!-e $request_filename) { + rewrite /wp-admin$ $scheme://$host$uri/ permanent; + rewrite ^(/[^/]+)?(/wp-.*) $2 last; + rewrite ^(/[^/]+)?(/.*\.php) $2 last; + } + + location / { + try_files $uri $uri/ /index.php?$args ; + } + + location ~ \.php$ { + try_files $uri =404; + include fastcgi_params; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_index index.php; + fastcgi_read_timeout 300; + fastcgi_send_timeout 300; + fastcgi_pass wp:9000; + } + + access_log /var/log/nginx/wordpress.access.log; + error_log /var/log/nginx/wordpress.error.log; + +} diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile new file mode 100644 index 0000000..214994d --- /dev/null +++ b/php-fpm/Dockerfile @@ -0,0 +1,28 @@ +FROM registry.sindominio.net/debian + +RUN apt-get update && \ + apt-get -qy install \ + php-fpm php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip \ + ghostscript wget openssl && \ + apt-get clean + +RUN useradd -lMs /sbin/nologin wordpress + +WORKDIR sindominio + +COPY wordpress.conf /etc/php/7.3/fpm/pool.d/www.conf +RUN mkdir /run/php/ +RUN mkdir logs + + +RUN wget -O wordpress.tar.gz "https://wordpress.org/latest.tar.gz" +RUN tar -xzf wordpress.tar.gz +RUN rm wordpress.tar.gz +COPY wp-config.php /sindominio/wordpress/wp-config.php +RUN chown -R www-data:www-data /sindominio/wordpress + +EXPOSE 9000 +VOLUME /sindominio/ + +CMD ["/usr/sbin/php-fpm7.3","--nodaemonize"]] + diff --git a/php-fpm/wordpress.conf b/php-fpm/wordpress.conf new file mode 100644 index 0000000..e0e8f95 --- /dev/null +++ b/php-fpm/wordpress.conf @@ -0,0 +1,16 @@ +[wordpress] + +user = wordpress +group = wordpress +listen = 9000 + +listen.owner = wordpress +listen.group = wordpress + +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 + +php_admin_value[error_log] = /wordpress/logs/fpm-php.log diff --git a/php-fpm/wp-config.php b/php-fpm/wp-config.php new file mode 100644 index 0000000..e69de29