下面是反代代码
[ol]#PROXY-START/
location ~* \.(php|jsp|cgi|asp|aspx)$
{
proxy_pass https://对方的域名;
proxy_set_header Host 对方的域名;
#向后端传递访客 ip
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;
#向后端传递访客 ip(反代CF增加规则)
proxy_ssl_name 对方的域名;
proxy_ssl_server_name on;
}
location /
{
proxy_pass https://对方的域名;
proxy_set_header Host 对方的域名;
#向后端传递访客 ip
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;
#向后端传递访客 ip
proxy_ssl_name 对方的域名;
proxy_ssl_server_name on;
#缓存设置
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 120m;
expires 12h;
}
#PROXY-END[/ol]复制代码