Skip to content

Instantly share code, notes, and snippets.

@nkt
Created March 31, 2016 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nkt/e24d697d9a675c5ab982e595ddd968a1 to your computer and use it in GitHub Desktop.
Save nkt/e24d697d9a675c5ab982e595ddd968a1 to your computer and use it in GitHub Desktop.
proxy_cache_path /var/www/npm_cache levels=2:2 keys_zone=npm_cache:10m max_size=20g inactive=1M use_temp_path=off;
server {
listen 80;
server_name npm.example.com;
location / {
rewrite ^ https://npm.example.com$request_uri permanent;
}
}
server {
listen 443 ssl http2;
server_name npm.example.com;
ssl on;
ssl_certificate /etc/nginx/ssl/npm.crt;
ssl_certificate_key /etc/nginx/ssl/npm.key;
access_log off;
error_log /var/log/npm.error.log notice;
location / {
proxy_pass https://registry.npmjs.org;
proxy_cache npm_cache;
proxy_cache_lock on;
proxy_cache_min_uses 1;
proxy_cache_revalidate off;
proxy_cache_use_stale error timeout invalid_header updating;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment