feat: add nginx reverse proxy configuration

This commit is contained in:
2026-03-15 15:09:07 -05:00
parent 1ffe7e53e1
commit 2e91fbad84
3 changed files with 36 additions and 2 deletions

View File

@@ -21,3 +21,8 @@ SMTP_DOMAIN="domain.com"
SMTP_PORT=465
SMTP_FROM="Company CO"
SMTP_EMAIL="domain@domain.com"
# NGINX
SERVER_NAME=tryton.domain.com
NGINX_PORT=10000
VARIABLE=$

View File

@@ -26,8 +26,6 @@ services:
TRYTOND_DATABASE_URI: ${TRYTOND_DATABASE_URI:-postgresql://${POSTGRES_USER:-naliia}:${POSTGRES_PASSWORD:-SUp3r-pass*DB}@${DB_HOSTNAME:-db}:5432/}
NALIIA_IMAGE: ${NALIIA_IMAGE:-gitea.onecluster.org/aserrador/naliia:latest}
EMAIL: ${EMAIL:-admin@admin.org}
ports:
- "${TRYTON_PORT:-8000}:8000"
depends_on:
db:
condition: service_healthy
@@ -71,6 +69,18 @@ services:
TRYTOND_DATABASE_URI: ${TRYTOND_DATABASE_URI:-postgresql://${POSTGRES_USER:-naliia}:${POSTGRES_PASSWORD:-SUp3r-pass*DB}@${DB_HOSTNAME:-db}:5432/}
env_file:
- .env
nginx:
image: nginx:1.23.3
volumes:
- ./nginx.conf:/etc/nginx/conf.d/nginx.conf.template
ports:
- "${NGINX_PORT:-10000}:${NGINX_PORT:-10000}"
env_file:
- .env
depends_on:
- tryton
- db
command: /bin/bash -c "envsubst < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
volumes:
postgres:

19
nginx.conf Normal file
View File

@@ -0,0 +1,19 @@
server {
server_name ${SERVER_NAME};
listen ${NGINX_PORT};
client_max_body_size 8M;
sendfile on;
send_timeout 500s;
location / {
proxy_pass http://tryton:8000/; # "trytond" is the service name of another Docker container on port 8000
proxy_read_timeout 500;
proxy_connect_timeout 500;
proxy_send_timeout 500;
proxy_set_header Host ${VARIABLE}host;
proxy_set_header X-Real-IP ${VARIABLE}remote_addr;
proxy_set_header X-Forwarded-For ${VARIABLE}proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host ${VARIABLE}server_name;
}
}