Last active
March 28, 2016 05:31
-
-
Save Barbery/927ae66c70c581586800 to your computer and use it in GitHub Desktop.
reverse proxy gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name gist.stutostu.com; | |
access_log off; | |
resolver 8.8.8.8; | |
location / { | |
proxy_pass https://gist.github.com$request_uri; | |
proxy_connect_timeout 6s; | |
proxy_set_header Accept-Encoding ""; | |
proxy_set_header User-Agent $http_user_agent; | |
proxy_set_header X-Forwarded-Host $host; | |
proxy_set_header X-Forwarded-Server $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
} |
server {
listen 80;
server_name gist.stutostu.com;
access_log off;
location / {
proxy_pass https://gist.github.com$request_uri;
resolver 8.8.8.8;
proxy_connect_timeout 6s;
proxy_set_header Accept-Encoding "";
proxy_set_header User-Agent $http_user_agent;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
这样?
resolver可以添加到: http, server, location 中,你们可以根据需求自行添加
# server, gist reverse proxy
server {
listen 80;
server_name gist.liamhuang.me;
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_redirect https://gist.github.com/ /;
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.liamhuang.me;
sub_filter https://gist.github.com/ http://gist.liamhuang.me;
sub_filter_once off;
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
需要在http{}block下添加
resolver 8.8.8.8;