濮阳杆衣贸易有限公司

主頁 > 知識(shí)庫 > Nginx http升級(jí)到https的完整步驟

Nginx http升級(jí)到https的完整步驟

熱門標(biāo)簽:江蘇電銷外呼防封系統(tǒng)是什么 智能電話機(jī)器人線路 東莞人工智能電銷機(jī)器人供應(yīng)商 金融行業(yè)外呼線路 長沙開福怎么申請(qǐng)400電話 廣州電銷機(jī)器人系統(tǒng)圖 百度地圖標(biāo)注要不要錢 高德地圖標(biāo)注無營業(yè)執(zhí)照 賀州市地圖標(biāo)注app

http和https的區(qū)別是

有的網(wǎng)站,http打開的時(shí)候,頁面提示不安全,比如你點(diǎn)擊下面的網(wǎng)站 【其實(shí)是同一個(gè)網(wǎng)站】

http://www.511easy.com/bug/login

http://www.88bugs.com/bug/login

 

怎樣才能去掉這個(gè)不安全的提示呢? 從http升級(jí)到https唄

最終效果看一下:

 

如果目前有一個(gè)網(wǎng)站,要怎么升級(jí)為https呢

域名: 511easy.com

有域名了就可以申請(qǐng)免費(fèi)的ssl證書,如下截圖,基于各個(gè)Web服務(wù)器的證書,我這邊用的是Nginx

那然后就需要配置nginx.conf的配置了,大概就是用下面的第三個(gè),前兩個(gè)是我用來保存的。

 https和http相比,更加安全,不盡然,用jmeter/charles/wireshark/fiddle等,生成一個(gè)證書,對(duì)https的網(wǎng)站都能進(jìn)行輕易的抓包,大多數(shù)的網(wǎng)站和app,我都能夠進(jìn)行抓包

 upstream tomcatserver1 {
  server 127.0.0.1:8083;
  }
 upstream tomcatserver2 {
  server 127.0.0.1:8085;
  }
   
   
   
server {
  listen  80;
  server_name 511easy.com;
 
 
  location / {
   proxy_pass http://tomcatserver1;
   index index.html index.htm;
  } 
 }
server {
  listen  80;
  server_name 511easy.com;
 
  location / {
   proxy_pass http://tomcatserver2;
   index index.html index.htm;
  }  
 }
worker_processes 1;
 
events {
 worker_connections 1024;
}
 
 
http {
 include  mime.types;
 default_type application/octet-stream;
 
 sendfile  on;
 
 keepalive_timeout 65;
 
 server {
  listen  80;
  server_name 88bugs;
  location / {
   proxy_pass http://localhost:8083;
  }
  }
 
 server {
  listen  80;
  server_name jenkins;
  location / {
   proxy_pass http://localhost:8080;
  }
  }
}
worker_processes 1;
 
events {
 worker_connections 1024;
}
 
 
http {
 include  mime.types;
 default_type application/octet-stream;
 
 sendfile  on;
 
 keepalive_timeout 65;
 
 
  server {
  listen 443 ssl;
  server_name www.511easy.com;
  
  ssl     on;
  ssl_certificate  1_511easy.com_bundle.crt;
  ssl_certificate_key   2_511easy.com.key;
  ssl_session_timeout 5m;
   
  location / {
   proxy_pass http://localhost:8083;
  }
 
  }
}

鞏固一下這幾個(gè)縮寫名詞的含義

HTTP --- Hyper Text Transfer Protocol,超文本傳輸協(xié)議,是一種建立在TCP上的無狀態(tài)連接,整個(gè)基本的工作流程是客戶端發(fā)送一個(gè)HTTP請(qǐng)求

HTTPS ---- Hyper Text Transfer Protocol over Secure Socket Layer 或 Hypertext Transfer Protocol Secure

全稱是:超文本安全傳輸協(xié)議,可以簡(jiǎn)單理解為使用SSL加密傳輸?shù)腍TTP協(xié)議

HTTP的默認(rèn)端口是80,HTTPS的默認(rèn)端口是443
SSL是為網(wǎng)絡(luò)通信提供安全及數(shù)據(jù)完整性的一種安全協(xié)議。

為什么要使用HTTPS

為了保護(hù)信息傳輸?shù)陌踩?,?shù)據(jù)完整性。讓訪客覺得網(wǎng)站可信任,對(duì)于國內(nèi)的網(wǎng)絡(luò)環(huán)境,也可以防止寬帶運(yùn)營商強(qiáng)制給網(wǎng)站掛廣告。

如果希望一臺(tái)服務(wù)器上,兩個(gè)端口,分別用不用的域名執(zhí)行不同的端口,Nginx可以這么配置

worker_processes 1;
 
events {
 worker_connections 1024;
}
 
 
http {
 include  mime.types;
 default_type application/octet-stream;
 
 sendfile  on;
 
 keepalive_timeout 65;
 
 
  server {
  listen 443 ssl;
  server_name www.88bugs.com;
  
  ssl_certificate  1_88bugs.com_bundle.crt;
  ssl_certificate_key 2_88bugs.com.key;
  ssl_session_timeout 5m;
   
  location / {
   proxy_pass http://localhost:8083;
  }
  }
  
  server {
  listen 443 ssl;
  server_name www.511easy.com;
  
  ssl_certificate  1_511easy.com_bundle.crt;
  ssl_certificate_key 2_511easy.com.key;
  ssl_session_timeout 5m;
   
  location / {
   proxy_pass http://localhost:8085;
  }
  } 
}

https://www.88bugs.com/bug/login

https://www.511easy.com/   【目前修改后是指向另一個(gè)端口的項(xiàng)目了】

總結(jié)

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)腳本之家的支持。

標(biāo)簽:玉樹 洛陽 松原 永州 張家界 滄州 廊坊 北京

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Nginx http升級(jí)到https的完整步驟》,本文關(guān)鍵詞  Nginx,http,升級(jí),到,https,的,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Nginx http升級(jí)到https的完整步驟》相關(guān)的同類信息!
  • 本頁收集關(guān)于Nginx http升級(jí)到https的完整步驟的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    马山县| 凤山市| 元朗区| 招远市| 南漳县| 镇巴县| 民乐县| 定结县| 慈利县| 樟树市| 军事| 海南省| 木兰县| 永兴县| 科技| 河池市| 南涧| 吉水县| 昌都县| 彰武县| 贵溪市| 舟曲县| 德钦县| 沧源| 六盘水市| 双江| 华亭县| 祥云县| 牟定县| 宜宾县| 玉山县| 平顶山市| 长寿区| 宁德市| 乌什县| 丹江口市| 新巴尔虎右旗| 义乌市| 洛宁县| 壤塘县| 宁强县|