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

环境是 nginx+php-fpm
nginx配置如下:
图片描述

路由配置:
Route::get('/', function () {

return view('welcome');

});

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

return 'hello world';

});

阅读 3.7k
3 个回答

放我的给你参考一下

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,看看

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题