nginxhls加密
發布時間: 2023-07-12 23:52:50
『壹』 如何在Nginx中添加SSL證書以支持HTTPS協議訪問
獲得Nginx環境SSL證書
安裝流程:
環境檢測,檢測命令如下(測試nginx是否支持SSL)nginx-V
如果有輸入 –with-http_ssl_mole 表示已編譯openssl,支持安裝ssl
如果沒有安裝請下載nginx源碼重新編譯:./configure--with-http_stub_status_mole--with-http_ssl_mole
make&&makeinstall配置Nginx
server{
listen80;
listen443ssl;
server_namewww.gworg.cn;
ssl_protocolsTLSv1.2TLSv1.1TLSv1;
ssl_certificate/etc/ssl/yourdomain.com.crt;
ssl_certificate_key/etc/ssl/yourdomain.com.key;
ssl_prefer_server_cipherson;
#自動跳轉到HTTPS(可選)
if($server_port=80){
rewrite^(.*)$https://$host$1permanent;
}
location/{
root/home/web/;
indexindex.php;
}
}以上配置僅供參考,其他參數請根據生產環境需要添加。
安裝後重啟nginx使其生
解決辦法:SSL證書可以在Gworg申請,然後根據以上文檔安裝,Nginx證書分為:crt公鑰與key私鑰2個文件。
熱點內容