Files
nginx-cache/nginx.conf
2026-01-07 21:52:09 +01:00

50 lines
1.4 KiB
Nginx Configuration File

events {
worker_connections 1024;
}
http {
client_body_temp_path /etc/nginx/data/temp;
proxy_temp_path /etc/nginx/data/temp;
fastcgi_temp_path /etc/nginx/data/temp;
uwsgi_temp_path /etc/nginx/data/temp;
scgi_temp_path /etc/nginx/data/temp;
proxy_cache_path /etc/nginx/data/cache levels=1:2 keys_zone=api_cache:10m max_size=100g inactive=365d;
error_log /dev/stdout warn;
log_format main '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" cache:$upstream_cache_status';
access_log /dev/stdout main;
resolver 127.0.0.11 valid=60s;
server {
listen 3000;
location / {
# If no url parameter, serve the readme
if ($arg_url = "") {
rewrite ^ /index.html last;
}
proxy_pass $arg_url;
proxy_http_version 1.1;
proxy_set_header Host $proxy_host;
proxy_ssl_server_name on;
proxy_cache api_cache;
proxy_cache_valid 200 201 202 203 204 205 206 207 208 226 365d;
proxy_cache_bypass $http_x_nocache;
proxy_no_cache $http_x_nocache;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
add_header X-Cache-Status $upstream_cache_status always;
}
location = /index.html {
root /usr/share/nginx/html;
}
}
}