-
Notifications
You must be signed in to change notification settings - Fork 3
/
nginx.conf
92 lines (76 loc) · 2.17 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Don't fork
daemon off;
# https://docs.nginx.com/nginx/admin-guide/monitoring/logging/
# Log to stderr
error_log stderr warn;
# Move PID to a place writable as non-root
pid /tmp/nginx.pid;
# Configure worker processes
worker_processes 1;
events {
worker_connections 1024;
}
http {
# Basic Settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
include mime.types;
default_type application/octet-stream;
# Put temp files in a place writable as non-root
client_body_temp_path /tmp/client_body;
fastcgi_temp_path /tmp/fastcgi_temp;
proxy_temp_path /tmp/proxy_temp;
scgi_temp_path /tmp/scgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
server {
server_name localhost $hostname "";
listen 8080;
# Use GZIP
gzip on;
gzip_min_length 2000;
gzip_proxied any;
gzip_types application/json;
proxy_read_timeout 60s;
client_max_body_size 64M;
# Root of devpi server directory
root /devpi;
# Log to stderr
error_log stderr warn;
# Try serving static files directly
location ~ /\+f/ {
error_page 418 = @proxy_to_app;
if ($request_method != GET) {
return 418;
}
expires max;
try_files /server/+files$uri @proxy_to_app;
}
location ~ /\+static/ {
error_page 418 = @proxy_to_app;
if ($request_method != GET) {
return 418;
}
expires max;
try_files /+static$uri @proxy_to_app;
}
# Try serving docs directly
location ~ /\+doc/ {
try_files /server$uri @proxy_to_app;
}
# Otherwise redirect to devpi
location / {
error_page 418 = @proxy_to_app;
return 418;
}
location @proxy_to_app {
proxy_pass http://devpi:4040;
proxy_set_header X-outside-url $scheme://$host:80;
proxy_set_header X-Real-IP $remote_addr;
expires -1; # no-cache
}
}
}