1
0
Fork 0

Update nginx.conf

This commit is contained in:
colin 2023-11-21 17:44:04 +00:00
parent 1580bd9c95
commit b3489c8dea
1 changed files with 12 additions and 4 deletions

View File

@ -8,6 +8,12 @@ events {
http { http {
default_type application/octet-stream; default_type application/octet-stream;
# Maps for handling WebSocket connections
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server { server {
listen 80; listen 80;
@ -18,23 +24,25 @@ http {
# Health check location at a secret path # Health check location at a secret path
location /secret-health-path { location /secret-health-path {
# This could be a simple return or proxy to an actual health check endpoint # A simple response to indicate Nginx is running
add_header Content-Type text/plain; add_header Content-Type text/plain;
return 200 'Healthy'; return 200 'Healthy';
} }
location / { location / {
# Use the placeholders for the proxy pass # Proxy pass to the backend using environment variables
proxy_pass ${PROTOCOL}://${BACKEND_ADDRESS}:${BACKEND_PORT}; proxy_pass ${PROTOCOL}://${BACKEND_ADDRESS}:${BACKEND_PORT};
# General proxy settings
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade"; proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding ""; proxy_set_header Accept-Encoding "";
proxy_buffering off; proxy_buffering off;
proxy_ssl_verify off; # Skip SSL verification, be cautious proxy_ssl_verify off; # Be cautious with this in a production environment
} }
} }
} }