1:基礎環境
Windows11-x64-23H2-22631.3155
Nginx-1.24.0
Mkcert-v1.4.4-windows-amd64
2:安裝Nginx
2-1:解壓後得到如下檔案
2-2:將此目錄在cmd中開啟
2-3:啟動Nginx
.\nginx.exe
2-4:瀏覽器檢視
2-5:擴充命令
.\nginx.exe
.\nginx.exe -s reload
.\nginx.exe -s stop
3:管理員開啟CMD
3-1:進行安裝
mkcert-v1.4.4-windows-amd64.exe install
3-2:檢視證書存放位置
mkcert-v1.4.4-windows-amd64.exe -CAROOT
3-3:檢視目錄下生成的檔案
3-4:檢視證書控制檯
win+r
輸入 certmgr.msc
3-5:雙擊檢視
3-6:證書已安裝,為localhost
127.0.0.1
::1
生成自簽證書
3-7:完成後會在mkcert-v1.4.4-windows-amd64.exe檔案同目錄下生成pem檔案和key檔案
3-8:將localhost+2.pem
localhost+2-key.pem
移動到nginx的conf目錄下
3-9:更改nginx
配置檔案nginx.conf
server {
listen 443 ssl;
server_name localhost;
ssl_certificate localhost+2.pem;
ssl_certificate_key localhost+2-key.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location /{
root html;
index index.html;
}
}
3-10:重啟nginx
服務
3-11:瀏覽器驗證
4:完結撒花~