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

How to jump to https through nginx load balancer

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

Today, the editor will share with you the relevant knowledge points about how to jump to https through nginx load balancing. the content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's learn about 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

These are all the contents of the article "how to jump to https through nginx load balancing". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

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

Internet Technology

Wechat

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

12
Report