How to jump to https through nginx load balancer
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.