Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A case of jumping to https through nginx load balancer

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the case of jumping to https through nginx load balancing, which has a certain reference value. Interested friends can refer to it. I hope you will learn a lot after reading this article. Let's take a look at it.

Copy certificate and key on web side

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

Configure on the server side of nginx load balancing

Vim / application/nginx/conf/nginx.conf

Worker_processes 2 error 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 weight=1 max_fails=3 fail_timeout=10 443 weight=1 max_fails=3 fail_timeout=10; # server 10.0.0.8 weight=1 max_fails=3 fail_timeout=10; # server 10.0.0.9443 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 permanent; 443; server_name www.abc.com; # enable https Note: add ssl on; ssl_certificate / application/nginx/conf/key/server.crt; ssl_certificate_key / application/nginx/conf/key/server.key in server block not in http block Location / {proxy_pass https://server_pools; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr;}

# check nginx load balancer configuration

/ application/nginx/sbin/nginx-t

# restart nginx load balancer

/ application/nginx/sbin/nginx-s stop

/ application/nginx/sbin/nginx

Browser access test

Note that the modified hosts corresponds to the IP address information of the load balancer.

Access test

Access result

Thank you for reading this article carefully. I hope the article "the case of jumping to https through nginx load balancing" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report