1
0
Fork 0

Update nginx.conf

This commit is contained in:
colin 2023-11-21 17:19:43 +00:00
parent 860e1456e3
commit 3402dd6674
1 changed files with 8 additions and 23 deletions

View File

@ -1,12 +1,12 @@
user nginx; user nginx;
worker_processes 1; worker_processes 1;
events { events {
worker_connections 1024; worker_connections 1024;
} }
http { http {
default_type application/octet-stream; default_type application/octet-stream;
server { server {
listen 80; listen 80;
@ -17,32 +17,17 @@ http {
} }
location / { location / {
# Use the placeholders for the proxy pass (ensure these are properly substituted) # Use the placeholders for the proxy pass
proxy_pass http://backend:port; # Replace with actual backend address and port proxy_pass ${PROTOCOL}://${BACKEND_ADDRESS}:${BACKEND_PORT};
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 $connection_upgrade; # This can handle both Upgrade and close proxy_set_header 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;
# Error handling (example)
error_page 502 /502.html;
location = /502.html {
root /usr/share/nginx/html;
internal;
}
} }
# Custom location for WebSocket if needed
# location /ws {
# proxy_pass http://backend:port;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "Upgrade";
# # Other necessary headers...
# }
} }
} }