此教程适用于集成安装包lnmp,官网是https://lnmp.org/

  一、 开启pathinfo  

#注释 下面这一行 
#include enable-php.conf
#载入新的配置文件
include  enable-php-pathinfo.conf

 

    LNMP一键安装包开启pathinfo和rewrite模式

  二、 开启rewrite

  在server最后添加如些的配置

#添加如下
        location / {
            if (!-e $request_filename){
                rewrite ^/(.*)$ /index.php/$1 last;
                break;
            }
        }
        location ~ /index.php {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root/index.php;
            include        fastcgi_params;
            fastcgi_param APPLICATION_ENV dev;
        }

    LNMP一键安装包开启pathinfo和rewrite模式

   三、 重启服务

    service nginx restart 

 

 

相关文章:

  • 2021-11-03
  • 2021-07-29
  • 2021-07-08
  • 2021-06-07
  • 2022-12-23
猜你喜欢
  • 2021-08-18
  • 2022-01-09
  • 2021-12-01
  • 2021-09-23
  • 2021-07-08
相关资源
相似解决方案