Nginx怎么配置SSL證書監(jiān)聽443端口

一、準(zhǔn)備證書文件

我使用的是阿里云symantec 免費(fèi)版 ssl證書。將證書文件下載后解壓得到如下文件

Nginx怎么配置SSL證書監(jiān)聽443端口

nginx–>cert目錄中建一個ssl目錄,將上面的所有文件拷貝到ssl目錄中

二、修改nginx.conf文件

在nginx.conf的http{}中填下如下內(nèi)容

server?{ ?listen?443; ?server_name?www.httpstest.com; ?ssl?on; ?root?html; ?index?index.html?index.htm; ?#這里的.pem/.key文件替換成自己對應(yīng)的文件名 ?ssl_certificate?cert/xxxxx.pem; ?ssl_certificate_key?cert/xxxx.key; ?ssl_session_timeout?5m; ?ssl_ciphers?ecdhe-rsa-aes128-gcm-sha256:ecdhe:ecdh:aes:high:!null:!anull:!md5:!adh:!rc4; ?ssl_protocols?tlsv1?tlsv1.1?tlsv1.2; ?ssl_prefer_server_ciphers?on; ?location?/?{ ??#代理的目標(biāo)地址 ??proxy_pass?http://127.0.0.1:10443; ?} }

最后別忘了重啟nginx服務(wù)。

? 版權(quán)聲明
THE END
喜歡就支持一下吧
點(diǎn)贊8 分享