nginx 配置 typecho 博客为 https 站点
in 码农技术宅 with 1 comment

nginx 配置 typecho 博客为 https 站点

in 码农技术宅 with 1 comment

证书

配置Nginx

SSL 配置文件

server {
    listen       443 ssl http2 reuseport;
    server_name  savokiss.com www.savokiss.com;

    ssl_certificate /etc/nginx/cert/xxx.pem;
    ssl_certificate_key /etc/nginx/cert/xxx.key;
    ssl_session_cache shared:SSL:1m;
    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;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
        root /usr/share/nginx/html/blog;
    index index.html index.htm index.php;
    }

    location ~ \.php(\/.*)*$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   /usr/share/nginx/html/blog$fastcgi_script_name;
        include        fastcgi_params;
    }


    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }
}

80端口配置文件

server {
    listen       80;
    server_name  savokiss.com  www.savokiss.com;
    rewrite ^(.*) https://savokiss.com$1 permanent;
}

重启Nginx

sudo nginx -s reload
Responses / Cancel Reply
  1. 谢谢,你的文章对我有很大的启发,学习了你的配置后,我也为我的博客添加了SSL

    Reply
京ICP备15030655号-1