环境

lnmp 1.7
typecho 1.1 正式版

配置

vim /usr/local/nginx/conf/rewrite/typecho.conf

    if (-f $request_filename/index.html){
        rewrite (.*) $1/index.html break;
    }
    if (-f $request_filename/index.php){
        rewrite (.*) $1/index.php;
    }
    if (!-f $request_filename){
        rewrite (.*) /index.php;
    }

vim /usr/local/nginx/conf/vhost/www.yudelei.com.conf

# 演示: 
# 80 301 443
# yudelei.com 301 到 www.yudelei.com
server
    {
        listen 80;
        #listen [::]:80;
        server_name www.yudelei.com yudelei.com ;

        return 301 https://www.yudelei.com$request_uri;
    }

server
    {
        listen 443 ssl http2;
        server_name yudelei.com ;

        # SSL 相关配置
        return 301 https://www.yudelei.com$request_uri;
    }

server
    {
        listen 443 ssl http2;
        #listen [::]:443 ssl http2;
        server_name www.yudelei.com ;
        ...

        # 在 SSL 配置下方 include typecho.conf
        include rewrite/typecho.conf;
        ...
    }
最后修改:2021 年 04 月 06 日 08 : 01 PM
如果觉得文章帮助了您,您可以随意赞赏。