lnmp下typecho出现404问题的解决

·
瀚星空 no tag January 24, 2017

完美解决



title: lnmp 搭建typecho出现404问题的解决+实现伪静态
tags:
grammar_cjkRuby: true

由于lnmp默认关闭了pathinfo功能,需要手动修改conf文件

位置:/usr/local/nginx/conf/vhost

在对应的conf中
将

include enable-php.conf;

修改为

include enable-php-pathinfo.conf;

保存后在shell输入指令

lnmp restart

重启lnmp后修改生效,若404问题仍未解决,可以尝试在conf中将

include typecho.conf

修改为

include typecho2.conf

大功告成

更新:lnmp伪静态规则:

在.conf文件中加入以下语句:

    location / {
        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;
        }
    }

    location ~ .*\.php(\/.*)*$ {
       fastcgi_split_path_info ^(.+\.php)(/.+)$;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       fastcgi_pass 127.0.0.1:9000;
       fastcgi_index index.php;
       include fastcgi_params;
  }

在后台中开启,顺利实现伪静态

  • typecho搬家过程:openshift到腾讯云
  • 归

_(:3 」∠)_
(抱歉)
这里不能评论哦


© 2025 夏末阁. Using Typecho & Moricolor.

陕ICP备16018536号-1