Update nginx.conf
Browse files- nginx.conf +12 -13
nginx.conf
CHANGED
|
@@ -12,11 +12,11 @@ server {
|
|
| 12 |
error_log /dev/stderr info; # 保持 info 级别,方便观察
|
| 13 |
|
| 14 |
location / {
|
| 15 |
-
# 1.
|
| 16 |
-
proxy_pass https://
|
| 17 |
|
| 18 |
-
# 2. 更新 Host 头部
|
| 19 |
-
proxy_set_header Host
|
| 20 |
|
| 21 |
# --- 保持之前尝试的浏览器伪装头部 ---
|
| 22 |
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -28,21 +28,20 @@ server {
|
|
| 28 |
proxy_set_header Accept-Encoding ""; # 保持清空,让后端决定
|
| 29 |
proxy_set_header Upgrade-Insecure-Requests "1";
|
| 30 |
proxy_set_header DNT "1";
|
| 31 |
-
# proxy_set_header Referer ""; # 可以清空 Referer
|
| 32 |
|
| 33 |
proxy_buffering off;
|
| 34 |
|
| 35 |
proxy_ssl_server_name on;
|
| 36 |
proxy_ssl_protocols TLSv1.2 TLSv1.3;
|
| 37 |
|
| 38 |
-
# 3. 更新 proxy_redirect 和 proxy_cookie_domain
|
| 39 |
-
proxy_redirect ~^https://(www\.)?
|
| 40 |
-
|
| 41 |
-
# 但为了通用性,可以保留:
|
| 42 |
-
proxy_redirect ~^http://(www\.)?huggingface\.co(?<path>.*)$ https://$host${path};
|
| 43 |
|
| 44 |
-
proxy_cookie_domain
|
| 45 |
-
|
|
|
|
| 46 |
# proxy_cookie_path /some_specific_path/ /;
|
| 47 |
}
|
| 48 |
-
}
|
|
|
|
| 12 |
error_log /dev/stderr info; # 保持 info 级别,方便观察
|
| 13 |
|
| 14 |
location / {
|
| 15 |
+
# 1. 改成代理 Google(HTTPS)
|
| 16 |
+
proxy_pass https://www.google.com;
|
| 17 |
|
| 18 |
+
# 2. 更新 Host 头部为 Google
|
| 19 |
+
proxy_set_header Host www.google.com;
|
| 20 |
|
| 21 |
# --- 保持之前尝试的浏览器伪装头部 ---
|
| 22 |
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
| 28 |
proxy_set_header Accept-Encoding ""; # 保持清空,让后端决定
|
| 29 |
proxy_set_header Upgrade-Insecure-Requests "1";
|
| 30 |
proxy_set_header DNT "1";
|
| 31 |
+
# proxy_set_header Referer ""; # 需要的话可以清空 Referer
|
| 32 |
|
| 33 |
proxy_buffering off;
|
| 34 |
|
| 35 |
proxy_ssl_server_name on;
|
| 36 |
proxy_ssl_protocols TLSv1.2 TLSv1.3;
|
| 37 |
|
| 38 |
+
# 3. 更新 proxy_redirect 和 proxy_cookie_domain 为 Google
|
| 39 |
+
proxy_redirect ~^https://(www\.)?google\.com(?<path>.*)$ https://$host${path};
|
| 40 |
+
proxy_redirect ~^http://(www\.)?google\.com(?<path>.*)$ https://$host${path};
|
|
|
|
|
|
|
| 41 |
|
| 42 |
+
proxy_cookie_domain .google.com $host;
|
| 43 |
+
proxy_cookie_domain google.com $host;
|
| 44 |
+
# 如果后面遇到登录 / 跳转问题,再细调 path:
|
| 45 |
# proxy_cookie_path /some_specific_path/ /;
|
| 46 |
}
|
| 47 |
+
}
|