今天在部署tp5的时候除了首页能访问。其他都是not found  

原因是 Nginx服务器默认不支持pathinfo,index.php后面的参数都没带上   在需要pathinfo支持的程序中

nginx除了首页都是404

则无法支持”/index.php/Home/Index/index”这种网址.后来看到燕十八老师的视频,是这么配置的。这是最简单的配置方法

  

 

  

# 典型配置
  location ~ \.php$ {
    root html;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT$fastcgi_script_name;
    include fastcgi_params;
  }

# 修改第1,6行,支持pathinfo

  location ~ \.php(.*)$ { # 正则匹配.php后的pathinfo部分
    root html;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT$fastcgi_script_name;
    fastcgi_param PATH_INFO $1; # 把pathinfo部分赋给PATH_INFO变量    
    include fastcgi_params;
    }

  如图:

nginx除了首页都是404

 转  http://www.yanshiba.com/archives/category/linux

相关文章:

  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
  • 2021-10-09
  • 2021-11-17
  • 2021-08-13
猜你喜欢
  • 2022-12-23
  • 2021-07-02
  • 2022-12-23
  • 2021-10-16
  • 2021-05-26
  • 2021-05-21
  • 2022-12-23
相关资源
相似解决方案