server
{
listen 80;
listen 443 ssl;
ssl on;
ssl_certificate /usr/local/nginx/conf/证书.crt;
ssl_certificate_key /usr/local/nginx/conf/证书.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
server_name www.1.com;
add_header Strict-Transport-Security “max-age=31536000”;
if ( $scheme = http ){
return 301 https://$server_name$request_uri;
}
if ($http_user_agent ~* (baiduspider|360spider|haosouspider|googlebot|soso|bing|sogou|yahoo|sohu-search|yodao|YoudaoBot|robozilla|msnbot|MJ12bot|NHN|Twiceler)) {
return 403;
}
location / {
sub_filter 2.com 1.com;
sub_filter_once off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Referer https://2.com;
proxy_set_header Host www.2.com;
proxy_pass https://2.com;
proxy_set_header Accept-Encoding “”;
}
}
解决了。。。
页:
1
[2]