Created
June 3, 2015 16:31
-
-
Save jackyyf/1b1fa8e93b15b66b6ae3 to your computer and use it in GitHub Desktop.
Gist by paste.py @ 2015-06-04 00:31:01.998949
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
upstream googleapis { | |
server fonts.googleapis.com:443; | |
keepalive 4; | |
} | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name f.eve.moe; | |
access_log /var/log/nginx/fproxy.log; | |
error_log /var/log/nginx/fproxy-err.log; | |
add_header Access-Control-Allow-Origin '*'; | |
location = /css { | |
if ($is_args = "") { | |
return 400; | |
} | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host fonts.googleapis.com; | |
proxy_cache off; | |
proxy_redirect off; | |
proxy_pass https://googleapis/css?$args; | |
proxy_connect_timeout 10s; | |
proxy_read_timeout 10s; | |
proxy_send_timeout 10s; | |
proxy_http_version 1.1; | |
proxy_set_header Connection "keep-alive"; | |
proxy_hide_header Alternate-Protocol; | |
subs_filter_types text/css; | |
subs_filter "https://fonts.gstatic.com" "http://g.eve.moe"; | |
} | |
location / { | |
return 400; | |
} | |
} | |
server { | |
listen 443 ssl spdy; | |
listen [::]:443 ssl spdy; | |
ssl on; | |
ssl_certificate /etc/nginx/ssl.d/f.crt; | |
ssl_certificate_key /etc/nginx/ssl.d/cdn.key; | |
server_name f.eve.moe; | |
access_log /var/log/nginx/fproxy.log; | |
error_log /var/log/nginx/fproxy-err.log; | |
add_header Access-Control-Allow-Origin '*'; | |
location = /css { | |
if ($is_args = "") { | |
return 400; | |
} | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host fonts.googleapis.com; | |
proxy_cache off; | |
proxy_redirect off; | |
proxy_pass https://googleapis/css?$args; | |
proxy_connect_timeout 10s; | |
proxy_read_timeout 10s; | |
proxy_send_timeout 10s; | |
proxy_http_version 1.1; | |
proxy_set_header Connection "keep-alive"; | |
proxy_hide_header Alternate-Protocol; | |
subs_filter_types text/css; | |
subs_filter "fonts.gstatic.com" "g.eve.moe"; | |
} | |
location / { | |
return 400; | |
} | |
} |
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
upstream gstatic { | |
server fonts.gstatic.com:443; | |
keepalive 8; | |
} | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name g.eve.moe; | |
access_log /var/log/nginx/gcache.log; | |
error_log /var/log/nginx/gcache-err.log; | |
add_header Access-Control-Allow-Origin '*'; | |
expires max; | |
root /home/gcache; | |
try_files $uri @fetch; | |
location /l { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host fonts.gstatic.com; | |
proxy_redirect off; | |
proxy_pass https://gstatic$request_uri; | |
proxy_connect_timeout 10s; | |
proxy_read_timeout 10s; | |
proxy_send_timeout 10s; | |
proxy_http_version 1.1; | |
proxy_set_header Connection "keep-alive"; | |
proxy_hide_header Alternate-Protocol; | |
} | |
location @fetch { | |
internal; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host fonts.gstatic.com; | |
proxy_store on; | |
proxy_store_access user:rw group:r all:r; | |
proxy_redirect off; | |
proxy_pass https://gstatic$request_uri; | |
proxy_connect_timeout 10s; | |
proxy_read_timeout 10s; | |
proxy_send_timeout 10s; | |
proxy_http_version 1.1; | |
proxy_set_header Connection "keep-alive"; | |
proxy_hide_header Alternate-Protocol; | |
} | |
} | |
server { | |
listen 443 ssl spdy; | |
listen [::]:443 ssl spdy; | |
ssl on; | |
ssl_certificate /etc/nginx/ssl.d/g.crt; | |
ssl_certificate_key /etc/nginx/ssl.d/cdn.key; | |
server_name g.eve.moe; | |
access_log /var/log/nginx/gcache.log; | |
error_log /var/log/nginx/gcache-err.log; | |
add_header Access-Control-Allow-Origin '*'; | |
expires max; | |
root /home/gcache; | |
try_files $uri @fetch; | |
location /l { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host fonts.gstatic.com; | |
proxy_redirect off; | |
proxy_pass https://gstatic$request_uri; | |
proxy_connect_timeout 10s; | |
proxy_read_timeout 10s; | |
proxy_send_timeout 10s; | |
proxy_http_version 1.1; | |
proxy_set_header Connection "keep-alive"; | |
proxy_hide_header Alternate-Protocol; | |
} | |
location @fetch { | |
internal; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host fonts.gstatic.com; | |
proxy_store on; | |
proxy_store_access user:rw group:r all:r; | |
proxy_redirect off; | |
proxy_pass https://gstatic$request_uri; | |
proxy_connect_timeout 10s; | |
proxy_read_timeout 10s; | |
proxy_send_timeout 10s; | |
proxy_http_version 1.1; | |
proxy_set_header Connection "keep-alive"; | |
proxy_hide_header Alternate-Protocol; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment