找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
楼主: mzxx

求一个https反向代理方案?

[复制链接]

41

主题

146

回帖

441

积分

中级会员

积分
441
发表于 2017-8-23 20:33:51 | 显示全部楼层
反代什么?我记得有个一建包,不过,宝塔和amh都有这功能
回复

使用道具 举报

15

主题

503

回帖

1071

积分

金牌会员

积分
1071
发表于 2017-8-23 20:13:00 | 显示全部楼层

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

给你个代码,参考一下:

server

爱小夜~听说小夜翻了,是去哪啊?!~

回复

使用道具 举报

150

主题

1974

回帖

4436

积分

论坛元老

积分
4436
发表于 2017-8-23 20:34:10 | 显示全部楼层
反代服务器上装上证书,源站有没有证书无所谓,直接用http也可以。
回复

使用道具 举报

40

主题

1094

回帖

2318

积分

金牌会员

积分
2318
发表于 2017-8-23 20:36:19 | 显示全部楼层
你需要https://github.com/fffonion/lua-resty-sniproxy。或者直接转发443流量,可以在nginx的stream模块里用PROXY协议转发,可以显示源ip
回复

使用道具 举报

23

主题

227

回帖

545

积分

高级会员

积分
545
发表于 2017-8-23 20:01:00 | 显示全部楼层
本帖最后由 aboutyj 于 2017-8-26 11:50 编辑

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

[ol]
  • 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.log  main;
  •     error_log /var/log/nginx/yourdomain.com/error.log;
  •     ssl on;
  •     ssl_certificate yourdomain.com.crt;
  •     ssl_certificate_key yourdomain.com.key;
  •     ssl_session_timeout  60m;
  •     ssl_protocols  SSLv2 SSLv3 TLSv1;
  •     ssl_ciphers  ALL:!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_page  404              /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;
  •     }
  • }[/ol]复制代码


  • 回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    Archiver|手机版|小黑屋|Discuz! X

    GMT+8, 2025-2-14 03:20 , Processed in 0.018473 second(s), 3 queries , Gzip On, Redis On.

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表