专业的编程技术博客社区

网站首页 > 博客文章 正文

LNMP环境配置SSL证书最简单教程(lnmp部署)

baijin 2024-09-07 12:10:00 博客文章 12 ℃ 0 评论

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

nginx重定向http自动跳转https

server
 {
 listen 80;
 server_name www.moerats.com;
 index index.html index.htm index.php;
 rewrite ^/(.*)$ https://www.moerats.com/$1 permanent;
 }

配置ssl证书

server
 {
 listen 443;
 #listen [::]:80;
 server_name www.moerats.com;
 index index.html index.htm index.php;
 root /app;
 ssl on;
 ssl_certificate /ssl/www.moerats.com.crt; #ssl.crt文件位置
 ssl_certificate_key /ssl/www.moerats.com.key; #ssl.key文件位置
 include typecho.conf;
 #error_page 404 /404.html;
 include enable-php-pathinfo.conf;
 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
 {
 expires 30d;
 }
 location ~ .*\.(js|css)?$
 {
 expires 12h;
 }
 location ~ /\.
 {
 deny all;
 }
 access_log off;
 }

最后重启VPS即可。

提示:军哥现在的lnmp1.4可以直接添加ssl证书了。

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表