曾经发过宝塔安装cdn的具体方法
配置修改方法如图
代码如下参考
#PROXY-START/
location ~* \.(php|jsp|cgi|asp|aspx|xhr|json)$
{
proxy_pass https://www.你的域名.com;
proxy_set_header Host www.你的域名.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 /
{
proxy_pass https://www.你的域名.com;
proxy_set_header Host www.你的域名.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 60m;
expires 12h;
}
#禁止缓存后台
location /admin
{
proxy_pass https://www.你的域名.com;
proxy_set_header Host www.你的域名.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;
add_header Cache-Control no-cache;
expires 12h;
}
#PROXY-END/