-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnginx.conf
More file actions
54 lines (42 loc) · 1.97 KB
/
nginx.conf
File metadata and controls
54 lines (42 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# This file configures our nginx reverse proxy by specifying the desired behavior for incoming requests.
# In this case, we forward all incoming requests and its request headers to the chat-ui.
# Enable detailed logging for debugging purposes
error_log /var/log/nginx/error.log debug;
# Automatically determine the number of worker processes based on CPU cores
worker_processes auto;
events {
# Set the maximum number of simultaneous connections each worker can handle
worker_connections 1024;
}
http {
# Define an upstream group for load balancing, even though we locally use one server
upstream chat_ui_group {
server chat-ui; # The hostname of the UI container, will be resolved by docker DNS
}
server {
# Listen for HTTP traffic on port 80
listen 80;
# The location block defines what requests to forward and how. We forward everything.
location / {
# Forward requests to the upstream group
proxy_pass http://chat_ui_group;
# Preserve the original hostname in the Host header, required to work with Azure Container Apps
proxy_set_header Host chat-ui;
# Add the client’s IP address to the X-Forwarded-For header
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Forward the original request protocol (HTTP/HTTPS)
proxy_set_header X-Forwarded-Proto $scheme;
# Forward the session cookie correctly
proxy_set_header Cookie $http_cookie;
# Use HTTP/1.1 for proxy connections, required to work with Azure if we want to run nginx manually
proxy_http_version 1.1;
}
# Serve a static Nginx welcome page for health checks or debugging
location /nginx {
# Map this location to the default Nginx HTML directory
alias /usr/share/nginx/html/;
# Use index.html as the default file to serve
index index.html;
}
}
}