PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

larval 路由只有 '/' 可以访问,其他路由都是404

原创
2016-06-06 20:16:48 1019浏览

环境是 nginx+php-fpm
nginx配置如下:

路由配置:
Route::get('//m.sbmmt.com/m/', function () {

return view('welcome');

});

Route::get('hello',function(){

return 'hello world';

});

回复内容:

环境是 nginx+php-fpm
nginx配置如下:

路由配置:
Route::get('//m.sbmmt.com/m/', function () {

return view('welcome');

});

Route::get('hello',function(){

return 'hello world';

});

放我的给你参考一下

server
{
    listen       80;
    server_name  Xxx.xxx.com;
    index index.php index.html index.htm;
    root  /xxx/xxx/xxx/public;
    access_log  /xxx/xxx/xxx.log  access;

  location ~ .*\.(php)?$
  {
    try_files $uri = 404;
    fastcgi_pass  unix:/tmp/php-cgi.sock;
    fastcgi_index index.php;
    include fcgi.conf;
  }

  location / {
    if (!-e $request_filename){
        rewrite ^/(.*)$ /index.php?s=/$1 last;
    }
    #try_files $uri $uri/ /index.php?$query_string;
  }
}

你设置rewrite了吗

去掉rewrite,看看

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。