-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf.tmpl
32 lines (27 loc) · 1013 Bytes
/
nginx.conf.tmpl
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
events {}
http {
# Define the cache path and parameters
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:${IN_RAM_SIZE} max_size=${MAX_CACHE_SIZE} inactive=${CACHE_DURATION} use_temp_path=off;
# Define the backend server
upstream backend_server {
server ${UPSTREAM_DOMAIN}:${UPSTREAM_PORT};
}
# Main server block
server {
listen 80;
server_name _;
# Define the cache zone
proxy_cache my_cache;
proxy_cache_valid any ${CACHE_DURATION};
location / {
# Proxy pass to the backend server
proxy_pass ${UPSTREAM_PROTOCOL}://backend_server;
# Additional cache settings
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
# Cache control headers
add_header X-Cache-Status ${DOLLAR}upstream_cache_status;
proxy_set_header Host "${UPSTREAM_HOST_HEADER}";
}
}
}