Advertisement
Guest User

Untitled

a guest
Mar 27th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. user www-data;
  2. worker_processes auto;
  3.  
  4. pid /var/run/nginx.pid;
  5.  
  6. events {
  7. worker_connections 1024;
  8. use epoll;
  9. }
  10.  
  11. http {
  12. proxy_cache_path /vault/npm-nginx-cache levels=1:2 keys_zone=STATIC_NPM:10m inactive=24h max_size=1g;
  13.  
  14. proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
  15. proxy_cache_lock on;
  16.  
  17. access_log /dev/stdout;
  18. error_log /dev/stdout;
  19.  
  20. gzip on;
  21. gzip_types application/json text/css text/javascript;
  22. gzip_proxied any;
  23. gzip_vary on;
  24.  
  25. sendfile on;
  26. tcp_nodelay on;
  27. tcp_nopush off;
  28. client_max_body_size 10G;
  29.  
  30. reset_timedout_connection on;
  31. server_tokens off;
  32. keepalive_timeout 65;
  33.  
  34. include /etc/nginx/mime.types;
  35.  
  36. upstream registry_npm {
  37. server registry.npmjs.org;
  38. server registry.npmjs.org;
  39. keepalive 128;
  40. }
  41.  
  42. server {
  43. listen 80;
  44. server_name _;
  45. client_max_body_size 10G;
  46. merge_slashes off;
  47. rewrite (.*)//(.*) $1/$2 permanent;
  48.  
  49. location /repository/npm-proxy/ {
  50. proxy_set_header Accept-Encoding "";
  51. sub_filter_types "application/json";
  52. sub_filter "https://registry.npmjs.org" $scheme://$host/repository/npm-proxy;
  53. sub_filter_once off;
  54. proxy_pass http://registry_npm/;
  55. proxy_set_header Host registry.npmjs.org;
  56. proxy_buffers 16 16k;
  57. proxy_buffer_size 16k;
  58. }
  59.  
  60. location ~ ^/.+/-/.+ {
  61. proxy_pass http://registry_npm;
  62. proxy_set_header Host registry.npmjs.org;
  63. proxy_buffering on;
  64. proxy_cache STATIC_NPM;
  65. proxy_cache_valid any 1d;
  66. proxy_cache_use_stale error timeout invalid_header updating
  67. http_500 http_502 http_503 http_504;
  68. proxy_hide_header Set-Cookie;
  69. proxy_hide_header Expect-CT;
  70. proxy_ignore_headers Set-Cookie;
  71. }
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement