這篇文章主要介紹了通過(guò)nginx負(fù)載均衡跳轉(zhuǎn)https的案例,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
創(chuàng)新互聯(lián)公司專(zhuān)注于橫山企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站,商城系統(tǒng)網(wǎng)站開(kāi)發(fā)。橫山網(wǎng)站建設(shè)公司,為橫山等地區(qū)提供建站服務(wù)。全流程定制網(wǎng)站設(shè)計(jì),專(zhuān)業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,創(chuàng)新互聯(lián)公司專(zhuān)業(yè)和態(tài)度為您提供的服務(wù)web端拷貝證書(shū)與密鑰
scp -rp -P52113 /application/nginx/conf/key 10.0.0.5:/application/nginx/conf/
在nginx負(fù)載均衡服務(wù)端配置
vim /application/nginx/conf/nginx.conf
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; #開(kāi)啟 https 注意要添加在server區(qū)塊 不能在http區(qū)塊中放置 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負(fù)載均衡配置
/application/nginx/sbin/nginx -t
#重啟nginx負(fù)載均衡
/application/nginx/sbin/nginx -s stop
/application/nginx/sbin/nginx
瀏覽器訪(fǎng)問(wèn)測(cè)試
注意修改hosts對(duì)應(yīng)的是負(fù)載均衡的IP地址信息
訪(fǎng)問(wèn)測(cè)試
訪(fǎng)問(wèn)結(jié)果
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“通過(guò)nginx負(fù)載均衡跳轉(zhuǎn)https的案例”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!