#PROXY-START/
location ~* \.(php|jsp|cgi|asp|aspx)$
{
proxy_pass https://www.blueskyxn.com;
proxy_set_header Host www.blueskyxn.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
}
location ~* \.(html|jpg|jpeg|mp4|ico|gif|png|webp|svg)$
{
proxy_pass https://www.blueskyxn.com;
proxy_set_header Host www.blueskyxn.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
proxy_ignore_headers Set-Cookie Cache-Control expires;
proxy_cache cache_one;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 304 301 302 43200m;
expires 24h;
}
location /
{
proxy_pass https://www.blueskyxn.com;
proxy_set_header Host www.blueskyxn.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
proxy_ignore_headers Set-Cookie Cache-Control expires;
proxy_cache cache_one;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 304 301 302 600m;
expires 12h;
}
#PROXY-END/
NGINX反向代理进阶教程:分类型缓存加速
SKY·2021-01-11·1,180 次阅读