LNMP环境配置SSL证书最简单教程

前端之家收集整理的这篇文章主要介绍了LNMP环境配置SSL证书最简单教程前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

现在腾讯提供免费的一年证书,地址:https://console.qcloud.com/ssl

Nginx重定向 http 自动跳转 https

  1. server
  2. {
  3. listen 80;
  4. server_name app.typecho.me;
  5. index index.html index.htm index.PHP;
  6. rewrite ^/(.*)$ https://plugins.typecho.me/$1 permanent;
  7. }

配置ssl证书:

  1. server
  2. {
  3. listen 443;
  4. #listen [::]:80;
  5. server_name app.typecho.me;
  6. index index.html index.htm index.PHP;
  7. root /app;
  8.     ssl on;
  9.     ssl_certificate /ssl/app.typecho.me_cert.crt;
  10.     ssl_certificate_key /ssl/app.typecho.me.key;
  11.     include typecho.conf;
  12.     #error_page   <a href="/tag/404/" target="_blank" class="keywords">404</a>   /<a href="/tag/404/" target="_blank" class="keywords">404</a>.html;
  13.     include enable-<a href="/tag/PHP/" target="_blank" class="keywords">PHP</a>-pathinfo.conf;
  14.     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  15.     {
  16.         expires      30d;
  17.     }
  18.     location ~ .*\.(js|css)?$
  19.     {
  20.         expires      12h;
  21.     }
  22.     location ~ /\.
  23.     {
  24.         deny all;
  25.     }
  26.     access_log off;
  27. }</pre>
  28. 安装完成。腾讯免费SSL证书+LNMP环境演示:https://app.typecho.me/

猜你在找的LNMP相关文章