如何通過(guò)nginx負(fù)載均衡跳轉(zhuǎn)https
web端拷貝證書與密鑰
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; #開啟 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
瀏覽器訪問(wèn)測(cè)試
注意修改hosts對(duì)應(yīng)的是負(fù)載均衡的IP地址信息
訪問(wèn)測(cè)試
訪問(wèn)結(jié)果
- nginx強(qiáng)制使用https訪問(wèn)的方法(http跳轉(zhuǎn)到https)
- 詳解NGINX訪問(wèn)https跳轉(zhuǎn)到http的解決方法
- 使用nginx方式實(shí)現(xiàn)http轉(zhuǎn)換為https的示例代碼
- Nginx域名轉(zhuǎn)發(fā)https訪問(wèn)的實(shí)現(xiàn)
- Nginx將http轉(zhuǎn)換成https的詳細(xì)過(guò)程
- Nginx實(shí)現(xiàn)http自動(dòng)跳轉(zhuǎn)到https
- Nginx配置HTTP強(qiáng)制跳轉(zhuǎn)到HTTPS的解決辦法
- nginx配置將HTTPS請(qǐng)求轉(zhuǎn)換成HTTP的方法實(shí)現(xiàn)
- Nginx強(qiáng)制跳轉(zhuǎn)Https(Http訪問(wèn)跳轉(zhuǎn)Https)
- https如何通過(guò)nginx完成雙向認(rèn)證轉(zhuǎn)發(fā)
- nginx實(shí)現(xiàn)http轉(zhuǎn)換為https的項(xiàng)目實(shí)踐
相關(guān)文章
Nginx+FastDFS搭建圖片服務(wù)器的方法實(shí)現(xiàn)
這篇文章主要介紹了Nginx+FastDFS搭建圖片服務(wù)器的方法實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-03-03Nginx實(shí)現(xiàn)不同域名輸出不同的服務(wù)器頭信息方法
這篇文章主要介紹了Nginx實(shí)現(xiàn)不同域名輸出不同的服務(wù)器頭信息方法,本文使用了一個(gè)ngx_headers_more模塊實(shí)現(xiàn)這個(gè)特殊需求,需要的朋友可以參考下2015-02-02Nginx報(bào)錯(cuò)host not found in upstream的解決辦法
本文主要介紹了Nginx報(bào)錯(cuò)host not found in upstream的解決辦法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2023-08-08centos7下基于nginx+uwsgi部署Django項(xiàng)目的實(shí)現(xiàn)
Django是一個(gè)開源的Web應(yīng)用框架,使用Python語(yǔ)言編寫,主要用于搭建Web項(xiàng)目,本教程介紹如何在centos7下基于nginx+uwsgi部署Django項(xiàng)目的實(shí)現(xiàn),感興趣的可以了解一下2024-04-04