如何为 Elastic Beanstalk 配置 Laravel?
Posted
技术标签:
【中文标题】如何为 Elastic Beanstalk 配置 Laravel?【英文标题】:How do I configure Laravel for Elastic Beanstalk? 【发布时间】:2012-11-25 01:03:42 【问题描述】:我已经启动了实例,但我的配置无法正常工作,我不知道如何让它工作。
我得到的只是 503 错误,没有任何解释。
生产模式配置
return array(
'url' => 'http://patientdueling.com',
'asset_url' => '',
'profiler' => false,
'ssl' => false,
);
【问题讨论】:
【参考方案1】:当我从可以控制的专用服务器切换到 Elastic Beanstalk 服务器和使用 AWS 的 RDS 时,出于某种原因,我的生产与开发环境不再被检测到。
我将我的生产配置复制到 laravel 的默认配置中,并且成功了!
我的错误:
exception 'ErrorException' with message 'PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/lib/mysql/mysql.sock)' in /var/www/html/laravel/database/connectors/mysql.php:33
Stack trace:
#0 /var/www/html/laravel/laravel.php(42): Laravel\Error::native(2, 'PDO::__construc...', '/var/www/html/l...', 33)
#1 [internal function]: Laravel\closure(2, 'PDO::__construc...', '/var/www/html/l...', 33, Array)
#2 /var/www/html/laravel/database/connectors/mysql.php(33): PDO->__construct('mysql:host=loca...', 'root', 'root', Array)
#3 /var/www/html/laravel/database.php(66): Laravel\Database\Connectors\MySQL->connect(Array)
#4 /var/www/html/laravel/database.php(52): Laravel\Database::connect(Array)
#5 /var/www/html/laravel/database/eloquent/query.php(255): Laravel\Database::connection(NULL)
#6 /var/www/html/laravel/database/eloquent/query.php(245): Laravel\Database\Eloquent\Query->connection()
#7 /var/www/html/laravel/database/eloquent/query.php(50): Laravel\Database\Eloquent\Query->table()
#8 /var/www/html/laravel/database/eloquent/model.php(473): Laravel\Database\Eloquent\Query->__construct(Object(System))
#9 /var/www/html/laravel/database/eloquent/model.php(789): Laravel\Database\Eloquent\Model->query()
#10 [internal function]: Laravel\Database\Eloquent\Model->__call('where_real_syst...', Array)
#11 [internal function]: System->where_real_system_id(0)
#12 /var/www/html/laravel/database/eloquent/model.php(804): call_user_func_array(Array, Array)
#13 /var/www/html/application/controllers/system.php(86): Laravel\Database\Eloquent\Model::__callStatic('where_real_syst...', Array)
#14 /var/www/html/application/controllers/system.php(86): System::where_real_system_id(0)
#15 [internal function]: System_Controller->get_list()
#16 /var/www/html/laravel/routing/controller.php(325): call_user_func_array(Array, Array)
#17 /var/www/html/laravel/routing/controller.php(285): Laravel\Routing\Controller->response('list', Array)
#18 /var/www/html/laravel/routing/controller.php(165): Laravel\Routing\Controller->execute('list', Array)
#19 /var/www/html/laravel/routing/route.php(153): Laravel\Routing\Controller::call('system@list', Array)
#20 /var/www/html/laravel/routing/route.php(124): Laravel\Routing\Route->response()
#21 /var/www/html/laravel/laravel.php(167): Laravel\Routing\Route->call()
#22 /var/www/html/public/index.php(34): require('/var/www/html/l...')
#23 main
【讨论】:
你好迈克尔,我来自未来,你又把我从这个问题中拯救了出来。谢谢你。附:我们现在都穿连身衣。以上是关于如何为 Elastic Beanstalk 配置 Laravel?的主要内容,如果未能解决你的问题,请参考以下文章
如何为我的 Elastic Beanstalk 单实例配置 SSL
如何为 Elastic Beanstalk 应用程序正确配置 Spring Datasource?
如何为 Elastic Beanstalk DOCKER 环境设置永久 DNS 名称?
如何为 Elastic Beanstalk 的 Tomcat 实例提供自定义日志附加程序?