全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
楼主: mzxx
打印 上一主题 下一主题

求一个https反向代理方案?

[复制链接]
1#
发表于 2017-8-26 11:48:36 | 显示全部楼层
本帖最后由 aboutyj 于 2017-8-26 11:50 编辑

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

  1. server {
  2.     listen 80;
  3.     server_name yourdomain.com;
  4.     return 301 https://yourdomain.com$request_uri;
  5. }

  6. server {
  7.     listen 443 ssl;
  8.     server_name yourdomain.com;
  9.     charset utf-8;

  10.     access_log /var/log/nginx/yourdomain.com/access.log  main;
  11.     error_log /var/log/nginx/yourdomain.com/error.log;

  12.     ssl on;
  13.     ssl_certificate yourdomain.com.crt;
  14.     ssl_certificate_key yourdomain.com.key;
  15.     ssl_session_timeout  60m;
  16.     ssl_protocols  SSLv2 SSLv3 TLSv1;
  17.     ssl_ciphers  ALL:!ADH:!EXPOR***56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
  18.     ssl_prefer_server_ciphers   on;
  19.     add_header Strict-Transport-Security "max-age=15552000; includeSubDomains";

  20.     error_page  404              /404.html;
  21.     location = /404.html {
  22.         root   /usr/share/nginx/html;
  23.     }

  24.     error_page   500 502 503 504  /50x.html;
  25.     location = /50x.html {
  26.         root   /usr/share/nginx/html;
  27.     }

  28.     location ~ \.*$ {
  29.         proxy_pass https://后端IP;
  30.         proxy_set_header Host $host;
  31.         proxy_set_header X-Forward-For $remote_addr;
  32.         proxy_set_header X-Real-IP $remote_addr;
  33.         proxy_set_header   X-Forwarded-Proto $scheme;
  34.     }

  35. }
复制代码


proxy.jpg (94.16 KB, 下载次数: 2)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-6-9 18:27 , Processed in 0.060371 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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