-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
137 lines (112 loc) · 3.55 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
worker_processes 1;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}
# quetz
http {
map $cache $control {
1 "max-age=1200";
}
map $uri $cache {
~*\.(json)$ 1;
}
map $http_x_forwarded_proto $x_scheme {
default $scheme;
http http;
https https;
}
proxy_temp_path /tmp/proxy_temp;
client_body_temp_path /tmp/client_temp;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 120;
gzip on;
gzip_types application/json;
client_max_body_size 1024m;
upstream quetz {
server conda_proxy:8001;
}
server {
listen 8003;
add_header Cache-Control $control;
server_name localhost;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://quetz;
}
location /files/channels/ {
# path for channels
alias /app/quetz/channels/;
# secure_link $arg_md5,$arg_expires;
# secure_link_md5 "$secure_link_expires$file_name mysecrettoken";
# if ($secure_link = "") { return 403; }
# if ($secure_link = "0") { return 410; }
}
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# devpi
server {
server_name localhost $hostname "";
listen 8004;
gzip on;
gzip_min_length 2000;
gzip_proxied any;
# add application/vnd.pypi.simple.v1+json to the gzip_types
gzip_types text/plain text/css text/xml
application/json application/vnd.pypi.simple.v1+json
application/javascript text/javascript
application/xml application/xml+rss;
proxy_read_timeout 120s;
client_max_body_size 1024m;
# set to where your devpi-server state is on the filesystem
root /app/devpi;
# try serving static files directly
location ~ /\+f/ {
# workaround to pass non-GET/HEAD requests through to the named location below
error_page 418 = @proxy_to_app;
if ($request_method !~ (GET)|(HEAD)) {
return 418;
}
expires max;
try_files /+files$uri @proxy_to_app;
}
# try serving docs directly
location ~ /\+doc/ {
# if the --documentation-path option of devpi-web is used,
# then the root must be set accordingly here
root /tmp/home/mydevpiserver;
try_files $uri @proxy_to_app;
}
location / {
# workaround to pass all requests to / through to the named location below
error_page 418 = @proxy_to_app;
return 418;
}
location @proxy_to_app {
proxy_pass http://pypi_proxy:8002;
# the $x_scheme variable is only required if nginx is behind another
# proxy (often the case in container environments),
# if your nginx is the only proxy server, the $scheme variable can be
# used and the map $http_x_forwarded_proto $x_scheme above be removed
proxy_set_header X-Forwarded-Proto $x_scheme;
proxy_set_header X-outside-url $x_scheme://$http_host;
proxy_set_header X-Real-IP $remote_addr;
}
}
}