Failing to deploy a Laravel app to EC2


I have my Laravel project all working on my localhost.
I deployed it to EC2, but nothing comes up.
All I see in the dev console is internal error (500).

What am I missing? What do I need to change before deploying to AWS? Here is the URL:

Here is the httpd.conf file:


After installing Laravel, you may need to configure some permissions.
Directories within the storage and the bootstrap/cache directories
should be writable by your web server. –

Laravel “Storage” folder and the “bootstrap/cache” folder needs access from both the command line user (the one that runs composer update etc) and the default web server user (www-data) in case you are using ubuntu on your EC2 instance.

The following three commands will ensure that both of them have the rights to do that. Run them at the root of your project

This should start displaying you specific errors that you can debug. Also make sure that you have the debug option set as true in app.php

Also make sure you have a default .env file that specifies the environment at the project root.

Also if you are using sessions etc make sure you have a generated a key by
using this command and doesn’t have config/app.php set as

‘key’ => env(‘APP_KEY’, ‘SomeRandomString’),

One common pitfall for new Amazon EC2 instances is to assign a security group
to your instance that doesn’t have port 80 and 443 allowed as inbound.
Please check your EC2 instance’s security group and allow those ports in the group if not already.

Leave a Reply