Jake Howard
f5a18fdca0
This lets whitenoise handle the headers, and nginx serves them quickly from the cache
50 lines
1.2 KiB
Nginx Configuration File
50 lines
1.2 KiB
Nginx Configuration File
proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=nginxcache:10m max_size=150m;
|
|
|
|
server {
|
|
listen 8000;
|
|
|
|
access_log /dev/stdout;
|
|
error_log /dev/stderr;
|
|
|
|
gzip_static on;
|
|
|
|
set_real_ip_from 0.0.0.0/0;
|
|
real_ip_header X-Forwarded-For;
|
|
|
|
# Override nginx's server header
|
|
more_set_headers "Server: Wouldn't you like to know";
|
|
server_tokens off;
|
|
|
|
proxy_buffers 32 4k;
|
|
proxy_connect_timeout 240;
|
|
proxy_headers_hash_bucket_size 128;
|
|
proxy_headers_hash_max_size 1024;
|
|
proxy_http_version 1.1;
|
|
proxy_read_timeout 240;
|
|
proxy_send_timeout 240;
|
|
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
proxy_set_header Proxy "";
|
|
|
|
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
|
|
proxy_cache_lock on;
|
|
proxy_cache_valid 404 1m;
|
|
|
|
location / {
|
|
proxy_pass http://localhost:8080;
|
|
}
|
|
|
|
location /static {
|
|
proxy_cache nginxcache;
|
|
add_header X-Cache-Status $upstream_cache_status;
|
|
proxy_pass http://localhost:8080;
|
|
}
|
|
|
|
location /media {
|
|
proxy_cache nginxcache;
|
|
add_header X-Cache-Status $upstream_cache_status;
|
|
proxy_pass http://localhost:8080;
|
|
}
|
|
}
|