现在腾讯提供免费的一年证书,地址: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证书了。
本文暂时没有评论,来添加一个吧(●'◡'●)