thinkphp nginx 下无法访问控制器

  1. 1.打开php.ini 使php支持pathinfo模式,cgi.fix_pathinfo=1;
  2. 2.打开nginx.conf,在server中增加如下重写规则,
  3. 根目录
    1. location / {
    2.         if (!-e $request_filename){
    3.             rewrite  ^/(.*)$  /index.php?s=$1  last;
    4.         }
    1.     }

  4. 若为二级目录如下
    1.  location /subdir/ {
    2.         if (!-e $request_filename){
    3.             rewrite  ^/subdir/(.*)$  /subdir/index.php?s=$1  last;
    4.         }
    1.     }

    3.重启lnmp;


  5. 4.访问地址去掉index.php



你可能感兴趣的:(thinkphp)