nginx+linux

 

问题描述:

安装了typecho显示成功安装,但是前端只显示标题和摘要,点击查看不了详细内容。

 

问题原因:

PHP这块不支持pathinfo,

 

官网提供的解决方案有一定参考性,但是不能完全复用

http://docs.typecho.org/servers

 

经过多次测试,将 Nginx 的 PHP 段改成如下形式,就可以访问文章详细信息了

 

    location ~ .*\.php(\/.*)*$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        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 /usr/share/nginx/html$real_script_name;
        fastcgi_param SCRIPT_NAME $real_script_name;
        fastcgi_param PATH_INFO $path_info;
        include        fastcgi_params;
    }

 

也就是添加 fastcgi_split_path_info ^(.+?.php)(/.*)$; 由 Nginx 设置 PATH_INFO 值。

然后重启服务使配置生效。

sudo systemctl restart nginx
sudo systemctl restart php-fpm

ok,可以访问了。

 

相关文章:

  • 2021-09-09
  • 2021-12-06
  • 2021-11-10
  • 2022-02-07
  • 2022-12-23
  • 2021-12-10
  • 2021-06-23
猜你喜欢
  • 2021-11-30
  • 2021-06-19
  • 2021-08-28
  • 2021-12-29
  • 2021-07-30
  • 2021-07-20
  • 2021-08-05
相关资源
相似解决方案