前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >如何通过nginx负载均衡跳转https

如何通过nginx负载均衡跳转https

作者头像
习惯说一说
修改2019-04-17 10:26:07
9780
修改2019-04-17 10:26:07
举报
文章被收录于专栏:服务器安全专线

这篇文章主要介绍了如何通过nginx负载均衡跳转https的相关资料,需要的朋友可以参考下

web端拷贝证书与密钥

   scp -rp -P52113 /application/nginx/conf/key 10.0.0.5:/application/nginx/conf/

在nginx负载均衡服务端配置

vim /application/nginx/conf/nginx.conf

代码语言:javascript
复制
worker_processes 2;error_log logs/error.log;events { worker_connections 65535;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream server_pools { server 10.0.0.200:443 weight=1 max_fails=3 fail_timeout=10; #server 10.0.0.8:443 weight=1 max_fails=3 fail_timeout=10; #server 10.0.0.9:443 weight=1 max_fails=3 fail_timeout=10; } server { listen 80; server_name localhost; rewrite ^(.*)$ https://$host$1 permanent; } server { listen 10.0.0.5:443; server_name www.abc.com; #开启 https 注意要添加在server区块 不能在http区块中放置 ssl on; ssl_certificate /application/nginx/conf/key/server.crt; ssl_certificate_key /application/nginx/conf/key/server.key; location / { proxy_pass https://server_pools; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; } }}

#检查nginx负载均衡配置

   /application/nginx/sbin/nginx -t

#重启nginx负载均衡

   /application/nginx/sbin/nginx -s stop    /application/nginx/sbin/nginx

浏览器访问测试

注意修改hosts对应的是负载均衡的IP地址信息

访问测试

访问结果

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
负载均衡
负载均衡(Cloud Load Balancer,CLB)提供安全快捷的流量分发服务,访问流量经由 CLB 可以自动分配到云中的多台后端服务器上,扩展系统的服务能力并消除单点故障。负载均衡支持亿级连接和千万级并发,可轻松应对大流量访问,满足业务需求。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档