add reverse proxy

This commit is contained in:
Matthos Denys 2021-03-08 21:07:37 +03:00
parent 42b8106d7f
commit e84685aab8
5 changed files with 27 additions and 5 deletions

View File

@ -4,7 +4,7 @@ http {
server { server {
listen 80 default_server; listen 80 default_server;
error_log logs/error.log debug; error_log logs/error.log debug;
return 301 https://$host$request_uri; return 301 https://$host$request_uri;
} }
@ -17,6 +17,20 @@ http {
ssl_certificate /etc/nginx/ssl/html.pem; ssl_certificate /etc/nginx/ssl/html.pem;
ssl_certificate_key /etc/nginx/ssl/html.key; ssl_certificate_key /etc/nginx/ssl/html.key;
location /wordpress {
return 307 https://$host:5050/;
}
location = ^(/phpmyadmin)$ {
proxy_pass https://192.168.99.150:5000/$1;
} }
location /phpmyadmin {
proxy_pass https://192.168.99.150:5000/;
proxy_redirect /index.php /phpmyadmin/index.php;
}
}
} }

View File

@ -1,13 +1,15 @@
FROM alpine:3.12 FROM alpine:3.12
LABEL maintainer="mdenys" LABEL maintainer="mdenys"
RUN apk update RUN apk update
RUN apk add supervisor nginx php7 php7-fpm php7-opcache php7-gd php7-mysqli php7-zlib php7-curl php7-mbstring php7-json php7-session mysql RUN apk add supervisor nginx php7 php7-fpm php7-opcache php7-gd php7-mysqli php7-zlib php7-curl php7-mbstring php7-json php7-session mysql openssl
RUN mkdir -p /var/www/localhost/htdocs/ RUN mkdir -p /var/www/localhost/htdocs/
RUN mkdir -p /run/php7 RUN mkdir -p /run/php7
RUN mkdir -p /run/nginx RUN mkdir -p /run/nginx
RUN wget http://files.directadmin.com/services/all/phpMyAdmin/phpMyAdmin-5.0.1-all-languages.tar.gz RUN wget http://files.directadmin.com/services/all/phpMyAdmin/phpMyAdmin-5.0.1-all-languages.tar.gz
RUN tar -xvf phpMyAdmin-5.0.1-all-languages.tar.gz --strip-components 1 -C /var/www/localhost/htdocs/ RUN tar -xvf phpMyAdmin-5.0.1-all-languages.tar.gz --strip-components 1 -C /var/www/localhost/htdocs/
COPY phpmyadmin.inc.php /var/www/localhost/htdocs/config.inc.php COPY phpmyadmin.inc.php /var/www/localhost/htdocs/config.inc.php
RUN mkdir /etc/nginx/ssl
RUN openssl req -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out /etc/nginx/ssl/html.pem -keyout /etc/nginx/ssl/html.key -subj "/C=RU/ST=Kazan/L=Kazan/O=21 School/OU=mdenys/CN=html"
RUN mkdir -p /var/www/localhost/htdocs/tmp RUN mkdir -p /var/www/localhost/htdocs/tmp
RUN chmod 777 /var/www/localhost/htdocs/tmp RUN chmod 777 /var/www/localhost/htdocs/tmp
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf

View File

@ -1,6 +1,8 @@
server { server {
listen 0.0.0.0:5000; listen 0.0.0.0:5000 ssl default_server;
server_name localhost; server_name localhost;
ssl_certificate /etc/nginx/ssl/html.pem;
ssl_certificate_key /etc/nginx/ssl/html.key;
root /var/www/localhost/htdocs/; root /var/www/localhost/htdocs/;
autoindex on; autoindex on;
index index.php; index index.php;

View File

@ -1,12 +1,14 @@
FROM alpine:3.12 FROM alpine:3.12
RUN apk update RUN apk update
RUN apk add curl supervisor nginx php7 php7-fpm php7-phar php7-opcache php7-gd php7-mysqli php7-zlib php7-curl php7-mbstring php7-json php7-session mariadb mariadb-client openrc RUN apk add openssl curl supervisor nginx php7 php7-fpm php7-phar php7-opcache php7-gd php7-mysqli php7-zlib php7-curl php7-mbstring php7-json php7-session mariadb mariadb-client openrc
RUN mkdir "/run/mysqld" && chown -R mysql /run/mysqld RUN mkdir "/run/mysqld" && chown -R mysql /run/mysqld
RUN mkdir -p /var/www/localhost/htdocs/ RUN mkdir -p /var/www/localhost/htdocs/
RUN mkdir -p /run/php7 RUN mkdir -p /run/php7
RUN mkdir -p /run/nginx RUN mkdir -p /run/nginx
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY supervisord.conf /etc/supervisord.conf COPY supervisord.conf /etc/supervisord.conf
RUN mkdir /etc/nginx/ssl
RUN openssl req -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out /etc/nginx/ssl/html.pem -keyout /etc/nginx/ssl/html.key -subj "/C=RU/ST=Kazan/L=Kazan/O=21 School/OU=mdenys/CN=html"
COPY start.sh . COPY start.sh .
COPY wp-cli.phar . COPY wp-cli.phar .
RUN chmod +x wp-cli.phar RUN chmod +x wp-cli.phar

View File

@ -1,9 +1,11 @@
server { server {
listen 0.0.0.0:5050; listen 0.0.0.0:5050 ssl default_server;
server_name localhost; server_name localhost;
root /var/www/localhost/htdocs/; root /var/www/localhost/htdocs/;
autoindex on; autoindex on;
index index.php; index index.php;
ssl_certificate /etc/nginx/ssl/html.pem;
ssl_certificate_key /etc/nginx/ssl/html.key;
location ~ \.php$ { location ~ \.php$ {
include fastcgi.conf; include fastcgi.conf;