forked from firstandthird/proxy-npm-bower
-
Notifications
You must be signed in to change notification settings - Fork 1
/
npm.conf
46 lines (33 loc) · 1002 Bytes
/
npm.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
# Cache 10G worth of packages for up to 1 month
proxy_cache_path /var/cache/npm/data levels=1:2 keys_zone=npm:16m inactive=1M max_size=10G;
# Multiple server definitions makes nginx retry
upstream registry_npm {
server registry.npmjs.org;
server registry.npmjs.org;
keepalive 16;
}
server {
listen 8001 default_server;
root /var/www;
gzip on;
gzip_types application/json text/css text/javascript;
gzip_proxied any;
gzip_vary on;
proxy_cache npm;
proxy_cache_key $uri;
proxy_cache_lock on;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_http_version 1.1;
proxy_pass_request_headers off;
proxy_set_header Host registry.npmjs.org;
location / {
proxy_cache_valid any 5m;
add_header X-Cache-Proxy $upstream_cache_status;
proxy_pass http://registry_npm;
}
location ~ ^/.+/-/.+ {
proxy_cache_valid any 1M;
add_header X-Cache-Proxy $upstream_cache_status;
proxy_pass http://registry_npm;
}
}