技术解析
想法是在目录下反代谷歌 一开始 location /{}这样弄没问题,但是我想把 location /{} 这种留给我的 blog 用,想在 location /google{}反代,但是问题来了,反代谷歌主页没问题,但是搜索 404. 所以是哪有问题呢?
这是我的配置。。话说 v2 排版有点奇怪 T_T
upstream yoyo { server 216.58.219.225:443 max_fails=3;
server 216.58.219.226:443 max_fails=3;
server 216.58.219.227:443 max_fails=3;
server 216.58.219.228:443 max_fails=3;
}
server {
listen 443 ssl;
#listen [::]:443 ss抗投诉服务器l;
server_name lalalaala;
ssl on;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!DSS:!PKS;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
location ^~/google{
proxy_redirect https://www.google.com/ /;
proxy_pass https://yoyo/;
proxy_set_header Host www.google.com;
proxy_set_header User-Agent $http_user_agent;
proxy_set_header Referer http://www.google.com;
proxy_set_header Accept-Encoding "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
}
}