Complete Guide

Deploy any Laravel App in AWS (Amazon Web Services)

Using AWS EC2 + RDS (Ubuntu, MySQL RDS)

Monday, April 19, 2021 (MDT)

Author: Emad Zaamout
Check if your website is working

Table of Contents

Deploying Laravel applications the correct way in 10 Steps using AWS.

In this tutorial we will cover

  1. Domain Registration

  2. Elastic IP Address

  3. Security Groups

  4. Launching RDS instance (For MySQL DB)

  5. Launching EC2 Linux Ubuntu Instance

  6. Requirements Gathering & Preparations

  7. Importing Laravel Project & Setting up folder permissions

  8. Installing & configuring Apache2, Installing Composer & Dependencies

  9. SSL Certification using Certbot

  10. [Optional] CloudWatch & Automated Notifications

Commands

Connect to EC2 Instance using SSH & PEM file.

ssh -i {pem file} {user}@{ip address}

Connect to your RDS MySQL Server.

mysql -h {rds_endpoint} -P 3306 -u admin -p

MySQL - Show Database

SHOW Databas;

MySQL - Create Database

CREATE DATABASE {db-name};

Git initialize local repository and configure user name and email


          git init
          git config --global user.email "support@ahtcloud.com"
          git config --global user.name "Emad Zaamout"
        

Git configure remote origin


          git remote add origin {bitbucket-repositry-url}
        

Git force push local changes and track remote origin master branch


          git push -u -f origin master
        

Git Pull your project


          git pull {bitbucket repository}
        

Laravel Ubuntu Linux Server Setup


          sudo apt-get update
          sudo apt-get dist-upgrade
          sudo apt-get install apache2
          sudo apt-get install software-properties-commo
          sudo add-apt-repository ppa:ondrej/php
          sudo apt update
          sudo apt-get install php7.4
          sudo apt install php-curl php-cli php-mbstring git unzip  php7.4-mysql php7.4-dom php7.4-xml php7.4-xmlwriter phpunit php-mbstring php-xml
          sudo apt install python3-certbot-apache
        

Install Composer


          php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
          php -r "if (hash_file('sha384', 'composer-setup.php') === 'c31c1e292ad7be5f49291169c0ac8f683499edddcfd4e42232982d0fd193004208a58ff6f353fde0012d35fdd72bc394') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
          php composer-setup.php
          php -r "unlink('composer-setup.php');"
        

Move composer.phar to bin/composer to make composer command executable


          sudo mv composer.phar /usr/local/bin/
        

Laravel Setup on Production Server


          php artisan migrate
          php artisan key:generate
        

Correct Laravel Folder Permissions


          sudo chown -R www-data storage
          sudo chown -R www-data storage/framework
          sudo chmod g+w -R storage
          sudo chmod g+w -R storage/framework
          sudo chmod g+w -R storage/framework/sessions/
          sudo chmod g+w -R storage/logs/
        

Create Apache2 Virtual Host configuration file for your project.


          <VirtualHost *:80>
          ServerAdmin support@ahtcloud.com
          ServerName greencleaningservices.ca
       ServerAlias www.greencleaningservices.ca
          DocumentRoot /var/www/greencleaningservices/public

       ErrorLog ${APACHE_LOG_DIR}/error.log
          CustomLog ${APACHE_LOG_DIR}/access.log combined

          <Directory /var/www/greencleaningservices>
              Require all granted
              AllowOverride All
              Options Indexes Multiviews FollowSymLinks
              </Directory>
          </VirtualHost>
        

Check if your website is correctly configured by using our free tool.

Check if your website is working

Other Posts

Windows WSL 2 Docker Tutorial Course Image

Tuesday, August 22 2023

Deploy any Dockerized application using AWS Course

Author: Emad Zaamout
Amazon Elastic Container Registry (AWS ECR)

Tuesday, June 27 2023

Amazon Elastic Container Registry (AWS ECR)

Author: Emad Zaamout
Custom Docker Images Course

Tuesday, June 27 2023

Custom Docker Images

Author: Emad Zaamout
Laravel Makefiles Course Image

Sunday, Oct 24, 2022

Laravel Makefiles

Author: Emad Zaamout
Windows WSL 2 Docker Tutorial Course Image

Sunday, Oct 24, 2022

Laravel Docker Course

Author: Emad Zaamout
Windows WSL 2 Docker Tutorial Course Image

Sunday, Oct 24, 2022

Laravel 9 Complete Course | Blog Implementation

Author: Emad Zaamout
Windows WSL 2 Docker Tutorial Course Image

Sunday, Oct 24, 2022

Windows WSL 2 Docker Tutorial

Author: Emad Zaamout
GIT Crash Course using Bitbucket By Emad Zaamout

Saturday May 1, 2021

Laravel Websockets Example Chat Application

Author: Emad Zaamout
GIT Crash Course using Bitbucket By Emad Zaamout

Saturday May 1, 2021

Laravel API Course | MVCS Repository Pattern

Author: Emad Zaamout
GIT Crash Course using Bitbucket By Emad Zaamout

Saturday October 24, 2021

Git Tutorial - Git Crash Course using BitBucket

Author: Emad Zaamout
What is AWS Elastic Load Balancer By Emad Zaamout

Monday October 18, 2021

AWS Elastic Load Balancing

Author: Emad Zaamout
DMARC SPF DKIM Course By Emad Zaamout

Saturday October 16, 2021

Email DNS Master Course - SPF + DKIM + DMARC

Author: Emad Zaamout
Email SPF Record Tutorial – Sender Policy Framework (SPF) | Prevent Email Spoofing | DNS Course By Emad Zaamout

Saturday October 16, 2021

Email SPF Record Tutorial – Sender Policy Framework (SPF) | Prevent Email Spoofing | DNS Course

Author: Emad Zaamout
DMARC Tutorial - How to set up DNS DMARC record | Protect Your Doman By Emad Zaamout

Saturday October 16, 2021

DMARC Tutorial - How to set up DNS DMARC record | Protect Your Doman

Author: Emad Zaamout
Git Hooks Crash Course

Sunday, September, 2021 (MDT)

Git Hooks Crash Course

Author: Emad Zaamout
Laravel CI\CD using AWS RDS EC2 S3 CodeDeploy BitBucket By Emad Zaamout

Friday, September 17, 2021 (MDT)

Laravel DevOps Tutorial - Laravel Deployment Automation CI\CD using AWS RDS EC2 S3 CodeDeploy BitBucket

Author: Emad Zaamout
Deploy any Laravel app in AWS (Amazon Web Services) By Emad Zaamout

Monday, April 19, 2021 (MDT)

Deploy any Laravel App in AWS (Amazon Web Services)

Author: Emad Zaamout
Fisher Yates Shuffle Algorithm Implementation? By Emad Zaamout

Saturday, September 26, 2020 (MDT)

Find out the secrets, tips and tricks to ranking number 1 on Google.

Author: Emad Zaamout
Fisher Yates Shuffle Algorithm Implementation? By Emad Zaamout

Saturday, September 26, 2020 (MDT)

Fisher - Yates Shuffle Algorithm Implementation

Author: Emad Zaamout
What Is an Ecommerce Website & How to Get Started (2020 guide)? By Emad Zaamout

Saturday, September 26, 2020 (MDT)

What Is an Ecommerce Website & How to Get Started (2020 guide)?

Author: Emad Zaamout
5 Reasons Why You Need A Website Calgary Website Design Company AHT Cloud

Thursday, May 7, 2020

5 Reasons Why You Need A Website

Author: Emad Zaamout
Whats Involved in Creating a Unique Custom Website? By Emad Zaamout

Thursday, May 7, 2020

Whats Involved in Creating a Unique Custom Website?

Author: Emad Zaamout
SEO Checklist By Emad Zaamout

Thursday, May 7, 2020

SEO CHECKLIST

Author: Emad Zaamout

GET YOUR FREE ESTIMATE

CONTACT US TODAY FOR YOUR FREE CONSULTATION!


Contact us today to discuss your goals and we will create a simple roadmap to get you there. We look forward to speaking with you!

Main Office

Phone:   1 587-834-6567
Email:   support@ahtcloud.com
32 Westwinds Crescent NE #130
Calgary, AB T3J 5L3, CA

Products

TMS
Cloud Based Transportation Management System


Hours Of Operation

Monday 8:00 am - 5:00 pm
Tuesday 8:00 am - 5:00 pm
Wednesday 8:00 am - 5:00 pm
Thursday 8:00 am - 5:00 pm
Friday 8:00 am - 5:00 pm
Saturday Closed
Sunday Closed