commit 93ddb5096b32079a47178d41b816ee803c67e8fd Author: Colin Date: Mon Sep 25 12:46:39 2023 -0400 adding basics diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7c8976c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +# Start from the official Nginx image +FROM nginx:alpine + +# Copy our custom Nginx configuration +COPY nginx.conf /etc/nginx/nginx.conf + + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d078b92 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3.9' + +services: + nginx-proxy: + build: + context: . + dockerfile: Dockerfile + image: codeberg.org/Iridium-net/lan-to-nginx:latest + environment: + - BACKEND_ADDRESS=192.168.8.1 # Replace with your backend address + - BACKEND_PORT=80 # Replace with your backend port + ports: + - "80:80" # Map port 80 from the host to port 80 in the container + diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..2e7df9d --- /dev/null +++ b/nginx.conf @@ -0,0 +1,28 @@ +user nginx; +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # Load environment variables + env BACKEND_ADDRESS; + env BACKEND_PORT; + + server { + listen 80; + + location / { + # Use the environment variables for the proxy pass + proxy_pass http://$BACKEND_ADDRESS:$BACKEND_PORT; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + } +} +