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

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

nginx重定向http自动跳转https

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

配置ssl证书

server
    {
        listen 443;
        #listen [::]:80;
        server_name www.southcat.net;
        index index.html index.htm index.php;
        root  /app;

        ssl on;
        ssl_certificate /ssl/www.southcat.net.crt; #ssl.crt文件位置
        ssl_certificate_key /ssl/www.southcat.net.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即可。



给TA打赏
共{{data.count}}人
人已打赏
cj

一款好用、美观的OneDrive目录列表程序:OLAINDEX

2019-12-18 23:59:56

cj

TeleShellBot:通过Telegram机器人远程执行shell命令

2019-12-19 6:11:03

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索