zhaoxi 发表于 2017-8-23 20:33:51

反代什么?我记得有个一建包,不过,宝塔和amh都有这功能

sky170 发表于 2017-8-23 20:13:00


小夜 发表于 2017-8-23 20:01

给你个代码,参考一下:

server
爱小夜~听说小夜翻了,是去哪啊?!~
010.gif

aumfoo 发表于 2017-8-23 20:34:10

反代服务器上装上证书,源站有没有证书无所谓,直接用http也可以。

deepflow 发表于 2017-8-23 20:36:19

你需要https://github.com/fffonion/lua-resty-sniproxy。或者直接转发443流量,可以在nginx的stream模块里用PROXY协议转发,可以显示源ip

dabiantai 发表于 2017-8-23 20:01:00

本帖最后由 aboutyj 于 2017-8-26 11:50 编辑

拿去参考
有记录用户ip,nginx日志有记录,也有传递用户IP到后端

[*]server {
[*]    listen 80;
[*]    server_name yourdomain.com;
[*]    return 301 https://yourdomain.com$request_uri;
[*]}
[*]
[*]server {
[*]    listen 443 ssl;
[*]    server_name yourdomain.com;
[*]    charset utf-8;
[*]
[*]    access_log /var/log/nginx/yourdomain.com/access.logmain;
[*]    error_log /var/log/nginx/yourdomain.com/error.log;
[*]
[*]    ssl on;
[*]    ssl_certificate yourdomain.com.crt;
[*]    ssl_certificate_key yourdomain.com.key;
[*]    ssl_session_timeout60m;
[*]    ssl_protocolsSSLv2 SSLv3 TLSv1;
[*]    ssl_ciphersALL:!ADH:!EXPOR***56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
[*]    ssl_prefer_server_ciphers   on;
[*]    add_header Strict-Transport-Security "max-age=15552000; includeSubDomains";
[*]
[*]    error_page404            /404.html;
[*]    location = /404.html {
[*]      root   /usr/share/nginx/html;
[*]    }
[*]
[*]    error_page   500 502 503 504/50x.html;
[*]    location = /50x.html {
[*]      root   /usr/share/nginx/html;
[*]    }
[*]
[*]    location ~ \.*$ {
[*]      proxy_pass https://后端IP;
[*]      proxy_set_header Host $host;
[*]      proxy_set_header X-Forward-For $remote_addr;
[*]      proxy_set_header X-Real-IP $remote_addr;
[*]      proxy_set_header   X-Forwarded-Proto $scheme;
[*]    }
[*]
[*]}复制代码


proxy.jpg
页: 1 2 3 [4]
查看完整版本: 求一个https反向代理方案?