终端设置代理
Linux/macOS bash/Windows Git Bash终端
- 使用
export https_proxy=http://127.0.0.1:7890;export http_proxy=http://127.0.0.1:7890;export all_proxy=socks5://127.0.0.1:7890
设置环境变量 - 使用
curl -verbose ip.gs
命令进行检查是否设置成功。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26export https_proxy=http://127.0.0.1:7890;export http_proxy=http://127.0.0.1:7890;export all_proxy=socks5://127.0.0.1:7890
curl -verbose ip.gs
* Uses proxy env variable http_proxy == 'http://127.0.0.1:7890'
* Trying 127.0.0.1:7890...
* Connected to 127.0.0.1 (127.0.0.1) port 7890 (#0)
GET http://ip.gs/ HTTP/1.1
Host: ip.gs
User-Agent: curl/7.84.0
Accept: */*
Referer: rbose
Proxy-Connection: Keep-Alive
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Cache-Control: no-cache
< Connection: keep-alive
< Content-Type: text/plain
< Date: Wed, 08 Feb 2023 06:01:21 GMT
< Keep-Alive: timeout=4
< Proxy-Connection: keep-alive
< Server: nginx
< Vary: Accept-Encoding
<
2607:f130:0:手动马赛克::d891:eccc
* Connection #0 to host 127.0.0.1 left intact- 使用
Windows CMD终端
- 使用
set http_proxy=http://127.0.0.1:7890 & set https_proxy=http://127.0.0.1:7890
设置环境变量 - 使用
curl -vvvk https://google.com
命令进行检查是否设置成功。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45C:\Users\R00004050>set http_proxy=http://127.0.0.1:7890 & set https_proxy=http://127.0.0.1:7890
C:\Users\R00004050>curl -vvvk https://google.com
* Uses proxy env variable https_proxy == 'http://127.0.0.1:7890'
* Trying 127.0.0.1:7890...
* Connected to 127.0.0.1 (127.0.0.1) port 7890 (#0)
* allocate connect buffer
* Establish HTTP proxy tunnel to google.com:443
> CONNECT google.com:443 HTTP/1.1
> Host: google.com:443
> User-Agent: curl/7.83.1
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection established
<
* Proxy replied 200 to CONNECT request
* CONNECT phase completed
* schannel: disabled automatic use of client certificate
* ALPN: offers http/1.1
* ALPN: server accepted http/1.1
> GET / HTTP/1.1
> Host: google.com
> User-Agent: curl/7.83.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
< Location: https://www.google.com/
< Content-Type: text/html; charset=UTF-8
< Date: Wed, 08 Feb 2023 06:52:11 GMT
< Expires: Fri, 10 Mar 2023 06:52:11 GMT
< Cache-Control: public, max-age=2592000
< Server: gws
< Content-Length: 220
< X-XSS-Protection: 0
< X-Frame-Options: SAMEORIGIN
< Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
<
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>
* Connection #0 to host 127.0.0.1 left intact
一些参数解释
- -v verbose (print errors/warnings while in event loop)
- -vv very verbose (also print client commands/reponses)
- -vvv extremely verbose (also print internal state transitions)
- -k 关闭SSL证书检查
- 使用