typecho后台永久链接设置问题

讨论程序使用中的问题
回复
David1107
帖子: 2
注册时间: 2015年 11月 7日 18:47

typecho后台永久链接设置问题

帖子 David1107 »

我的博客后台管理里面永久链接设置时,提示“重写功能检测失败, 请检查你的服务器设置”。
我的服务器配置如下

代码: 全选

include /etc/nginx/conf.d/*.conf;
   include /etc/nginx/sites-enabled/*;
   
   
    server {
        listen          80;
        server_name     我的域名;
        root            /home/www/blog/;
        index           index.html index.htm index.php;
 

        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
        }

        location ~ .*\.php(\/.*)*$ {
         include fastcgi.conf;
         fastcgi_pass unix:/var/run/php5-fpm.sock;
         fastcgi_index index.php;
         fastcgi_split_path_info ^(.+?\.php)(/.*)$;
         set $path_info "";
         set $real_script_name $fastcgi_script_name;
         if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
            set $real_script_name $1;
            set $path_info $2;
         }
         fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
         fastcgi_param SCRIPT_NAME $real_script_name;
         fastcgi_param PATH_INFO $path_info;
         try_files $fastcgi_script_name =404;
        }
    }

在sites-enabled下的default配置文件内容为:

代码: 全选

server {
   listen 80 default_server;

   index index.html index.htm index.nginx-debian.html;

   server_name 我的域名;

   location / {
         index index.html index.php;
         if (!-e $request_filename){
               rewrite ^(.*)$ /index.php$1 last;
         }
      }
}

求大神指点下,我的配置哪里出了问题,PS:其他功能都正常,谢谢!
头像
m4go
帖子: 857
注册时间: 2010年 3月 29日 02:33
来自: https://www.vpshu.com
联系:

Re: typecho后台永久链接设置问题

帖子 m4go »

检测失效可以不鸟他,仍然开启。如果除首页外全部404,则为伪静态部分问题,建议设置为:

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;
}
}
David1107
帖子: 2
注册时间: 2015年 11月 7日 18:47

Re: typecho后台永久链接设置问题

帖子 David1107 »

没有问题了,谢谢楼上!
jazzi
帖子: 43
注册时间: 2016年 3月 5日 22:07

Re: typecho后台永久链接设置问题

帖子 jazzi »

m4go 写了:检测失效可以不鸟他,仍然开启。

那就是说这个自动检测结果是不靠谱的咯?我刚刚为此问题责骂空间提供商呢

为什么会这样?!
回复