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


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

  一、 开启pathinfo  

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

 

    

  二、 开启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;
        }

    

   三、 重启服务

    service nginx restart 

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM