This means less time is spent in gunicorn, letting the workers process other requests sooner.
59 lines
1.4 KiB
Nginx Configuration File
59 lines
1.4 KiB
Nginx Configuration File
proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=nginxcache:10m max_size=150m inactive=24h;
|
|
|
|
client_body_temp_path /tmp/client_temp;
|
|
proxy_temp_path /tmp/proxy_temp_path;
|
|
fastcgi_temp_path /tmp/fastcgi_temp;
|
|
uwsgi_temp_path /tmp/uwsgi_temp;
|
|
scgi_temp_path /tmp/scgi_temp;
|
|
|
|
server {
|
|
listen 8000;
|
|
|
|
access_log /dev/stdout;
|
|
error_log /dev/stderr;
|
|
|
|
gzip_static on;
|
|
|
|
gzip on;
|
|
gzip_vary 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_valid 404 1m;
|
|
|
|
location / {
|
|
proxy_pass http://localhost:8080;
|
|
gzip_types *;
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|