Skip to content

Instantly share code, notes, and snippets.

@OhYee
Created November 22, 2018 15:53
Show Gist options
  • Save OhYee/1b01fb0050af57ce3a5c6043e10f261b to your computer and use it in GitHub Desktop.
Save OhYee/1b01fb0050af57ce3a5c6043e10f261b to your computer and use it in GitHub Desktop.
reverse proxy to gist
# server, gist reverse proxy
server {
listen 80;
server_name gist.oyohyee.com;
access_log off;
resolver 8.8.8.8;
location / {
proxy_pass https://gist.github.com;
proxy_cache_valid 200 302 1h;
proxy_cache_valid 404 1m;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_set_header Accept-Encoding "";
proxy_set_header Accept-Language "zh-CN";
proxy_set_header User-Agent $http_user_agent;
sub_filter https://gist-assets.github.com/ http://gist.oyohyee.com/;
sub_filter https://gist.github.com/ http://gist.oyohyee.com/;
sub_filter https://github.com/ http://gist.oyohyee.com/;
sub_filter_once off;
}
}
# server, gist reverse proxy
server {
listen 443 ssl http2 default_server;
server_name gist.oyohyee.com;
access_log off;
resolver 8.8.8.8;
ssl_certificate "/etc/nginx/ssl/1_gist.oyohyee.com_bundle.crt";
ssl_certificate_key "/etc/nginx/ssl/2_gist.oyohyee.com.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass https://gist.github.com;
proxy_cache_valid 200 302 1h;
proxy_cache_valid 404 1m;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_set_header Accept-Encoding "";
proxy_set_header Accept-Language "zh-CN";
proxy_set_header User-Agent $http_user_agent;
sub_filter https://gist-assets.github.com/ http://gist.oyohyee.com/;
sub_filter https://gist.github.com/ http://gist.oyohyee.com/;
sub_filter https://github.com/ http://gist.oyohyee.com/;
sub_filter_once off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment