From 32cecb92f67f781089d98c98d723536c8a601a7b Mon Sep 17 00:00:00 2001 From: Hyperling Date: Wed, 5 Oct 2022 02:51:52 -0500 Subject: [PATCH] First attempt at an NGINX reverse proxy skeleton. --- Config/ReverseProxy/Dockerfile | 11 +++++++ Config/ReverseProxy/config/conf.d/test.conf | 2 ++ Config/ReverseProxy/config/nginx.conf | 34 +++++++++++++++++++++ Config/ReverseProxy/docker-compose.yml | 20 ++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 Config/ReverseProxy/Dockerfile create mode 100644 Config/ReverseProxy/config/conf.d/test.conf create mode 100644 Config/ReverseProxy/config/nginx.conf create mode 100644 Config/ReverseProxy/docker-compose.yml diff --git a/Config/ReverseProxy/Dockerfile b/Config/ReverseProxy/Dockerfile new file mode 100644 index 0000000..83e0ad4 --- /dev/null +++ b/Config/ReverseProxy/Dockerfile @@ -0,0 +1,11 @@ +# 2022-10-05 Hyperling +# Move config to nginx container. +# This is because nginx image does not play well with Volumes. +# Nextcloud and MariaDB created files in their folders fine, but nginx stays empty. + +FROM nginx + +COPY ./config/nginx.conf /etc/nginx/nginx.conf + +COPY ./config/conf.d/* /etc/nginx/conf.d/ + diff --git a/Config/ReverseProxy/config/conf.d/test.conf b/Config/ReverseProxy/config/conf.d/test.conf new file mode 100644 index 0000000..4b8c2a9 --- /dev/null +++ b/Config/ReverseProxy/config/conf.d/test.conf @@ -0,0 +1,2 @@ +# 2022-10-05 Hyperling +# Just a dummy test file. diff --git a/Config/ReverseProxy/config/nginx.conf b/Config/ReverseProxy/config/nginx.conf new file mode 100644 index 0000000..c8c359b --- /dev/null +++ b/Config/ReverseProxy/config/nginx.conf @@ -0,0 +1,34 @@ +# 2022-10-05 Hyperling + +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} + diff --git a/Config/ReverseProxy/docker-compose.yml b/Config/ReverseProxy/docker-compose.yml new file mode 100644 index 0000000..f5ce6e4 --- /dev/null +++ b/Config/ReverseProxy/docker-compose.yml @@ -0,0 +1,20 @@ +# 2022-10-05 Hyperling +# Reverse Proxy +# This is a revised version of the original work here: +# https://phoenixnap.com/kb/docker-nginx-reverse-proxy +# https://www.docker.com/blog/how-to-use-the-official-nginx-docker-image/ + +version: '2' + +services: + app: + image: nginx + restart: always +# Instead of using a volume, have the config files in . and COPY them to container with DockerFile +# volumes: +# - /opt/Docker/Volumes/ReverseProxy/nginx:/etc/nginx/ + build: ./ + ports: + - 8081:80 + - 8082:443 +