-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
74 lines (59 loc) · 1.5 KB
/
nginx.conf
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
daemon off;
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /dev/stdout;
error_log /dev/stdout;
gzip on;
gzip_disable "msie6";
include /etc/nginx/uwsgi_params;
upstream uwsgi_upstream {
server 127.0.0.1:8000;
}
# Match the upstream header buffer size to http setting
uwsgi_buffer_size 64k;
uwsgi_buffers 8 64k;
uwsgi_read_timeout 60s;
uwsgi_send_timeout 60s;
uwsgi_cache_path /app/var/nginx levels=1:2 keys_zone=cache:1m max_size=1g inactive=10m use_temp_path=off;
server {
listen 8080;
server_name _;
location = /favicon.ico {
access_log off;
log_not_found off;
}
location /static/ {
allow all;
root /app;
}
location /media/ {
allow all;
root /app/var;
}
location / {
uwsgi_pass uwsgi_upstream;
}
location /api {
uwsgi_pass uwsgi_upstream;
uwsgi_cache cache;
uwsgi_cache_key $request_uri;
uwsgi_cache_lock on;
uwsgi_cache_background_update on;
uwsgi_cache_min_uses 10; # Count requests for an url before the response is cached
uwsgi_cache_valid 200 1m; # Cache 200 requeste for 1 minute
uwsgi_cache_bypass $cookie_sessionid; # Invalidate cache for request with the sessionid cookie value (logged-in users)
}
}
}