I've never deployed to EC instance but did you verify that there is a .ENV and make any necessary corrections to .htacess files? Just a thought.
Deploying Laravel to EC2
Hi Guys,
I have my laravel project all working on my localhost. I deployed it to EC2, and 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: ec2-52-88-99-75.us-west-2.compute.amazonaws.com
I just deploy mine through aws elastic beanstalk. Costs just about the same as running an EC2 instance with no level server configuration to worry about.
With Laravel 5.1 I just zip the entire folder and upload it through the beanstalk web interface.
Assuming that you have installed apache, mysql, openhttp,mcrypt and that you are trying to make things work on Ubuntu
- Check if mod rewrite is enabled - sudo a2enmod rewrite
- Give permissions to your storage and vendor folders - chmod 755 -R laravel and then chmod -R o+w storage
- Check if you app.config has the environment variables set correctly including the 'url' . Set it to point to the right URL.
- If you are using database ensure that you have your database.config set to the correct database for e.g. mysql. Set the database, user id and password
- Go to /etc/apache2/sites-available/ and change your Document root to point to your Laravel public folder. (the one where you have your project installed)
- Go to /etc/apache2 and use either of mcedit/vi/nano apache.conf and make the following modifications to /var/www/, you may also want to add this as an additional entry Assuming this is your DocumentRoot "/var/www/html/laravel/public/" <Directory "/var/www/html/laravel/public"> Allowoverride All Require all granted
- Restart your apache-> apachectl restart or use a command that you find to handy.
Test your pages -- oops problem? Are you getting a file not found issue. Try the following. Check your .htaccess for correctness.
Sometimes you may come across crytp issues this is caused due issues with your key. Try the following..
In your console write: "php artisan key:generate". Secondly, get the 32 characters to config/app.php like 'key' => env('APP_KEY', 'insert get 32 char key')
restart Apache again.
you may also want to clear the route cache by typing in the following
-> php artisan route:clear
Other issues that you would encounter is table not found. If you were developing on windows environment and have deployed the code to aws chances are that these are caused due to case sensitivity of linux environment.
@rajiv hi rajiv thanks for explanation i installed laravel successful and done all configuration, but got one error page page is not working , can you please help me http://54.169.105.32/
@mayank_8jun did you set up your security group? e.g open port 80 for http requests? Since you IP is not reachable
@cristopher I already set up the below things in security inbound HTTP SSH MYSQL/Aurora RDP HTTPS
What is with the outbound traffic? Did you allow all traffic?
Because the site isnt reachable so it could be that all outbound traffic is blocked.
@christopher Yes outbound traffic is set to all
@mayank_8jun did you terminate your aws infrastructure and create a new one. Check your ip.
When i tried, the error states that the site cannot be reached!
Did you try deploying a simple html page and try reaching it?
Please or to participate in this conversation.