在服务器上部署 Laravel 工程

用 Laravel 框架写了一个工程,已经在本机测试好了,准备部署到一台外网服务器(阿里云的)。

目前这台服务器操作系统是 Ubuntu 12.04,装了 PHP 5.6.18,根据 JellyBool 的帖子 进行了 Nginx 配置,访问后是 Laravel 的出错页面,如下:

图片描述

看了一下 larval.log 中的 log,内容如下:

    [2016-02-25 10:24:42] production.ERROR: exception 'ReflectionException' with message 'Class App\Http\Controllers\OfficialWebsiteController does not exist' in /var/www/shark/vendor/illuminate/routing/Route.php:264
    Stack trace:
    #0 /var/www/shark/vendor/illuminate/routing/Route.php(264): ReflectionMethod->__construct('App\\Http\\Contro...', 'index')
    #1 /var/www/shark/vendor/illuminate/routing/Router.php(838): Illuminate\Routing\Route->signatureParameters('Illuminate\\Data...')
    #2 /var/www/shark/vendor/illuminate/routing/Router.php(823): Illuminate\Routing\Router->substituteImplicitBindings(Object(Illuminate\Routing\Route))
    #3 /var/www/shark/vendor/illuminate/routing/Router.php(806): Illuminate\Routing\Router->substituteBindings(Object(Illuminate\Routing\Route))
    #4 /var/www/shark/vendor/illuminate/routing/Router.php(670): Illuminate\Routing\Router->findRoute(Object(Illuminate\Http\Request))
    #5 /var/www/shark/vendor/illuminate/routing/Router.php(654): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
    #6 /var/www/shark/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(246): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
    #7 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
    #8 /var/www/shark/vendor/illuminate/routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
    #9 /var/www/shark/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(44): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
    #10 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
    #11 /var/www/shark/vendor/illuminate/pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
    #12 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
    #13 /var/www/shark/vendor/illuminate/routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
    #14 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
    #15 /var/www/shark/vendor/illuminate/pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
    #16 /var/www/shark/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
    #17 /var/www/shark/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
    #18 /var/www/shark/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
    #19 {main}  
  

执行过 composer dump-autoload,提示一行绿字 Generating autoload files,没有成功失败提示。

另外,php 没有启用 openssl,尝试启用但是遇到一些麻烦,不知道目前是否有必要,暂时没有启用。

阅读 5.3k
2 个回答

OfficialWebsiteController does not exist
反射这个控制器,没有找到,看看是不是命名大小写的问题

是不是命名空间问题

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