laravel 路由除了首页404

$ cd /usr/local/nginx/conf

$ vim nginx.conf

1,开启pathinfo (设置网站配置文件)

添加一行

include enable-php-phpinfo.conf

2,开启rewrite

在service最后添加如下配置 (此处if 与 “(” 之间要有空格)

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_param;

   fastcgi_param    APPLICATION_ENV dev;

}

测试完成

 

posted @ 2019-07-03 15:33  尚真  阅读(388)  评论(0)    收藏  举报