nginx 正向代理的问题
資深大佬 : sockball07 1
根据 该文章 使用以下配置即可正向代理
server { resolver 114.114.114.114; listen 80; location / { proxy_pass http://$host$request_uri; } } server { resolver 114.114.114.114; listen 443; location / { proxy_pass https://$host$request_uri; } }
使用即
curl -x http://[ip]:80 www.baidu.com curl -x http://[ip]:443 www.reddit.com
由于想加入密码, 于是加入 http basic 验证配置
server { ... auth_basic "auth_basic"; auth_basic_user_file /data/http_basic_auth.txt; ... }
而使用只能这样
curl -u 'user:pass' -x http://[ip]:443 www.reddit.com
问:
-
如上的配置, 是不是意味着 http basic 验证的部分同样会转发给将要代理的站点
-
该配置与一般的
curl -x http://[user]:[pass]@[ip]:[port] https://www.reddit.com有何不同,nginx 是否也能配置成这样?
大佬有話說 (10)