Skip to content

Instantly share code, notes, and snippets.

@kevintpeng
Last active July 4, 2016 19:19
Show Gist options
  • Save kevintpeng/b72e8ed2550b44b731e64fb0983672ff to your computer and use it in GitHub Desktop.
Save kevintpeng/b72e8ed2550b44b731e64fb0983672ff to your computer and use it in GitHub Desktop.
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
proxy_cache_path /var/cache/rubygems levels=1:2 keys_zone=rubygems_cache:60m
inactive=90m max_size=1000m;
proxy_temp_path /var/cache/rubygems/tmp;
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
server {
# sets DNS resolver to use Google's DNS
#resolver 8.8.8.8;
listen 80;
# matches the request to the "Host" Header Field
# server_name rubygems.org;
location / {
#expires max;
#proxy_cache rubygems_cache;
#proxy_cache_valid 200 302 301 1h;
#proxy_cache_valid any 1m;
#proxy_cache_key "$scheme://$host$request_uri";
#proxy_pass $scheme://$host$request_uri;
#proxy_set_header Host $http_host;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_ignore_headers "Set-Cookie";
add_header X-Forwarded-Server $host;
add_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header X-Cache-Status $upstream_cache_status;
proxy_pass https://rubygems.org;
#proxy_redirect off;
#proxy_set_header Host $http_host;
proxy_cache rubygems_cache;
proxy_cache_valid 200 120m;
proxy_cache_use_stale error timeout invalid_header http_500 http_502 http_503 http_504;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment