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 miss
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. - http://laravel.com/docs/master#configuration
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
HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX storage bootstrap/cache
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX storage bootstrap/cache
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
yourproject/config/app.php
'debug' => true,
Also make sure you have a default .env file that specifies the environment at the project root.
yourproject/.env
//should have this
APP_ENV = dev
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'),
yourproject/config/app.php
php artisan key:generate
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.
This worked for me:
[root@example-laravel-server ~]# chown -R apache:apache /var/www/laravel/laravel/storage