as今天准备把网站搬迁到nginx上发现codeigniter框架在nginx上不能使用,后来发现是nginx不支持pathinfo,下面介绍怎么在nginx下开启pathinfo和去掉index.php

location / {
    # 这里使用try_files进行url重写,不用rewrite了。
    try_files $uri $uri/ /index.php?$query_string;
}
 
location ~ \.php($|/) {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_param   PATH_INFO $fastcgi_path_info;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

 

相关文章:

  • 2021-06-19
  • 2021-05-24
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
  • 2021-06-19
猜你喜欢
  • 2022-01-17
  • 2022-02-05
  • 2021-07-06
  • 2022-12-23
  • 2021-05-16
  • 2022-02-25
相关资源
相似解决方案