Nginx Http Proxy 代理服务器配置

196 views
Skip to first unread message

red-hat

unread,
Jun 12, 2013, 9:57:26 AM6/12/13
to openresty

Nginx 正向代理配置文件:

server {
    resolver 8.8.8.8;
    resolver_timeout 5s;
 
    listen 0.0.0.0:8080;
 
    access_log  /home/reistlin/logs/proxy.access.log;
    error_log   /home/reistlin/logs/proxy.error.log;
 
    location / {
        proxy_pass $scheme://$host$request_uri;
        proxy_set_header Host $http_host;
 
        proxy_buffers 256 4k;
        proxy_max_temp_file_size 0;
 
        proxy_connect_timeout 30;
 
        proxy_cache_valid 200 302 10m;
        proxy_cache_valid 301 1h;
        proxy_cache_valid any 1m;
    }
}


不支持代理 Https 网站

因为 Nginx 不支持 CONNECT,所以无法正向代理 Https 网站(网上银行,Gmail)。
如果访问 Https 网站,比如:https://www.google.com,Nginx access.log 日志如下:

"CONNECT www.google.com:443 HTTP/1.1" 400
请问各位大大 nginx 正向代理 如何支持HTTPS的 请求?

wd

unread,
Jun 12, 2013, 10:38:20 PM6/12/13
to open...@googlegroups.com
好像可以代理的吧?我这好像没问题。不过是你的客户端会报证书有问题。加个 dns ?
resolver 8.8.8.8;



2013/6/12 red-hat <w79...@gmail.com>

--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty...@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
归档: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
教程: http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html
 
 

Reply all
Reply to author
Forward
0 new messages