Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- user www-data;
- worker_processes auto;
- pid /var/run/nginx.pid;
- events {
- worker_connections 1024;
- use epoll;
- }
- http {
- proxy_cache_path /vault/npm-nginx-cache levels=1:2 keys_zone=STATIC_NPM:10m inactive=24h max_size=1g;
- proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
- proxy_cache_lock on;
- access_log /dev/stdout;
- error_log /dev/stdout;
- gzip on;
- gzip_types application/json text/css text/javascript;
- gzip_proxied any;
- gzip_vary on;
- sendfile on;
- tcp_nodelay on;
- tcp_nopush off;
- client_max_body_size 10G;
- reset_timedout_connection on;
- server_tokens off;
- keepalive_timeout 65;
- include /etc/nginx/mime.types;
- upstream registry_npm {
- server registry.npmjs.org;
- server registry.npmjs.org;
- keepalive 128;
- }
- server {
- listen 80;
- server_name _;
- client_max_body_size 10G;
- merge_slashes off;
- rewrite (.*)//(.*) $1/$2 permanent;
- location /repository/npm-proxy/ {
- proxy_set_header Accept-Encoding "";
- sub_filter_types "application/json";
- sub_filter "https://registry.npmjs.org" $scheme://$host/repository/npm-proxy;
- sub_filter_once off;
- proxy_pass http://registry_npm/;
- proxy_set_header Host registry.npmjs.org;
- proxy_buffers 16 16k;
- proxy_buffer_size 16k;
- }
- location ~ ^/.+/-/.+ {
- proxy_pass http://registry_npm;
- proxy_set_header Host registry.npmjs.org;
- proxy_buffering on;
- proxy_cache STATIC_NPM;
- proxy_cache_valid any 1d;
- proxy_cache_use_stale error timeout invalid_header updating
- http_500 http_502 http_503 http_504;
- proxy_hide_header Set-Cookie;
- proxy_hide_header Expect-CT;
- proxy_ignore_headers Set-Cookie;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement