當(dāng)前位置:
首頁(yè) >
Nginx配置免费SSL证书
發(fā)布時(shí)間:2025/3/21
67
豆豆
生活随笔
收集整理的這篇文章主要介紹了
Nginx配置免费SSL证书
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
SSL證書(shū)HTTPS優(yōu)勢(shì)
購(gòu)買(mǎi)域名型免費(fèi)版(DV)SSL證書(shū)
安裝SSL證書(shū):參考官方文檔
nginx中的配置:nginx配置https轉(zhuǎn)發(fā)到tomcat
server {listen 443;server_name lzhhuo.wordpython.com www.lzhhuo.wordpython.com;ssl on;index index.html index.htm; if ($http_host ~ "^lzhhuo.wordpython.com$") {rewrite ^(.*) https://www.lzhhuo.wordpython.com$1 permanent;}ssl_certificate 1_www.lzhhuo.wordpython.com_bundle.crt; ssl_certificate_key 2_www.lzhhuo.wordpython.com.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:8080/;proxy_connect_timeout 600;proxy_read_timeout 600;}}server {listen 80;server_name lzhhuo.wordpython.com www.lzhhuo.wordpython.com;if ($http_host ~ "^lzhhuo.wordpython.com$") {rewrite ^(.*) https://www.lzhhuo.wordpython.com$1 permanent;}rewrite ^(.*) https://www.lzhhuo.wordpython.com$1 permanent;location / {root /usr/local/apache-tomcat-8.5.28/webapps/ROOT;index index.html index.htm; } }可能出現(xiàn)的問(wèn)題:
錯(cuò)誤:nginx:[emerg]unknown directive ssl錯(cuò)誤
原因:配置SSL證書(shū)需要引用到nginx的中SSL這模塊,然而我們一開(kāi)始編譯的Nginx的時(shí)候并沒(méi)有把SSL模塊一起編譯進(jìn)去。
解決: Nginx配置SSL證書(shū)時(shí)——nginx:[emerg]unknown directive ssl錯(cuò)誤
效果:
Chrome:
Firefox:
IE:
Opera:
總結(jié)
以上是生活随笔為你收集整理的Nginx配置免费SSL证书的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Typora最好用的Markdown编辑
- 下一篇: Docker 安装 Nginx