Nginx搭建https伺服器

2021-07-30 09:44:28 字數 1055 閱讀 6981

https簡介

https(hypertext transfer protocol over secure socket layer),是以安全為目標的http通道,簡單來講就是http的安全版。即http下加入ssl層,https的安全基礎是ssl,因此加密的詳細內容就需要ssl。

它是乙個uri scheme(抽象識別符號體系),句法類同http:體系,用於安全的http資料傳輸。https使用的預設埠是443.

ssl證書

證書型別簡介

要設定安全伺服器,使用公共鑰建立一對公私鑰對。大多數情況下,傳送證書請求(包括自己的公鑰),你的公司證明材料以及費用到乙個證書頒發機構(ca).ca驗證證書請求及您的身份,然後將證書返回給您的安全伺服器。

但是內網實現乙個伺服器端和客戶端傳輸內容的加密,可以自己給自己頒發證書,只需要忽略掉瀏覽器不信任的警報即可!

由ca簽署的證書為您的伺服器提供兩個重要的功能:

生成ssl證書

openssl genrsa -des3 -out wangzhengyi.key 2048

openssl req -new -key wangzhengyi.key -out wangzhengyi.csr

建立乙個自己簽署的ca證書

openssl req -new -x509 -days 3650 -key wangzhengyi_nopass.key -out wangzhengyi.crt

搭建https虛擬主機

虛擬主機配置檔案

upstream sslfpm

server  

# redirect server error pages to the static page /50x.html

#error_page  500 502 503 504  /50x.html;

error_page  404 /404.html;

location = /50x.html

location = /404.html

# proxy the php scripts to fpm

location ~ \.php$ }

nginx搭建https伺服器

https hypertext transfer protocol over secure socket layer 是以安全為目標的http通道,簡單來講就是http的安全版。即http下加入ssl層,https的安全基礎是ssl,因此加密的詳細內容就需要ssl。它是乙個uri scheme 抽象...

nginx 搭建https伺服器

安裝在之前的文章中已經寫過了。但是之前的安裝出現了錯誤導致https沒有安裝成功。所以這裡提一下大致的流程以及問題 openssl v ersion 命令用來列印版本以及 openssl 其他各種資訊。用法 cpp view plain copy openssl version a v b o f ...

nginx搭建https伺服器

https hypertext transfer protocol over secure socket layer 是以安全為目標的http通道,簡單來講就是http的安全版。即http下加入ssl層,https的安全基礎是ssl,因此加密的詳細內容就需要ssl。它是乙個uri scheme 抽象...