Failed to install Laravel application for EC2

I have a Laravel project that is working on my localhost. I deployed it to EC2, but nothing came of it. All I see in the dev console is an internal error (500).

What am I missing? What do I need to change before deploying to AWS? Here is the URL: http://ec2-52-88-99-75.us-west-2.compute.amazonaws.com

Here is the httpd.conf file: http://collabedit.com/sdcxm

+5
source share
2 answers

After installing Laravel, you may need to configure some permissions. Directories in the repository and boot / cache directories should be writable by your web server. - http://laravel.com/docs/master#configuration

The Laravel Storage folder and the bootstrap / cache folder need access from the command line user (the one that starts the linker update, etc.) and the default web server user (www-data) if you use ubuntu on your EC2 instance.

The following three teams ensure that both are entitled to it. 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 -mu:"$HTTPDUSER":rwX -mu:`whoami`:rwX storage bootstrap/cache sudo setfacl -dR -mu:"$HTTPDUSER":rwX -mu:`whoami`:rwX storage bootstrap/cache 

This should start displaying specific errors that can be debugged. Also make sure the debug option is set to true in app.php

 yourproject/config/app.php 'debug' => true, 

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

 yourproject/.env //should have this APP_ENV = dev 

Also, if you use sessions, etc., make sure that you have the generated key using this command and that it does not have config / app.php set as

'key' => env ('APP_KEY', 'SomeRandomString'),

 yourproject/config/app.php php artisan key:generate 

One common mistake for new instances of Amazon EC2 is to assign a security group to your instance that does not have ports 80 and 443 allowed as incoming. Check your EC2 instance security group and enable these ports in the group if they were not already.

+8
source

This worked for me:

 [ root@example-laravel-server ~]# chown -R apache:apache /var/www/laravel/laravel/storage 
0
source

Source: https://habr.com/ru/post/1232872/


All Articles