First attempt at an NGINX reverse proxy skeleton.

This commit is contained in:
Hyperling 2022-10-05 02:51:52 -05:00
parent 1134bc7a1e
commit 32cecb92f6
4 changed files with 67 additions and 0 deletions

View File

@ -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/

View File

@ -0,0 +1,2 @@
# 2022-10-05 Hyperling
# Just a dummy test file.

View File

@ -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;
}

View File

@ -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