一、準備證書文件
我使用的是阿里云Symantec 免費版 SSL證書。將證書文件下載后解壓得到如下文件
在nginx–>cert目錄中建一個ssl目錄,將上面的所有文件拷貝到ssl目錄中
二、修改nginx.conf文件
在nginx.conf的http{}中填下如下內容
server { listen 443; server_name www.httpstest.com; ssl on; root html; index index.html index.htm; #這里的.pem/.key文件替換成自己對應的文件名 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 / { #代理的目標地址 proxy_pass http://127.0.0.1:10443; }}
最后別忘了重啟nginx服務。
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。
新聞熱點
疑難解答