环境

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;
        ...
    }
Last modification:April 6th, 2021 at 08:01 pm
如果觉得我的文章对你有用,可以请我喝杯咖啡。