nginx typecho 后台404解决方案

nimaboke 2017-7-21 2304

使用lnmp或者其它方法装的环境一般都会用nginx,而nginx使用的伪静态就有点麻烦,它不是apache环境的.htaccess,而是在服务器中需要建一个以.conf结尾的文件。

typecho具体规则如下:
location / {
index index.html index.php;
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;
}
}

如果使用了伪静态规则还是404的话请进入
/usr/local/nginx/conf/vhost/youname.com.conf
找到
include enable-php.conf;
替换为
include enable-php-pathinfo.conf;
然后保存重启即可(lnmp一键包的重启命令为/etc/init.d/nginx restart

姜辰2017/07/22 13:35:54 评论:
话说原理是啥啊?

admin2017/07/23 21:58:54 回应
可能直接写入cookie 要达到效果有很多种方法的

admin2017/07/23 22:02:17 回应
回复错了233 pathinfo() 函数能以数组的形式返回文件路径的信息,typecho默认伪静态是http://xxx.xx/index.php/xxxxx
最新回复 (0)
返回
发新帖