New Get started on Amezmo with a $50, 12-month credit for new users. Create free account →

How to Host and Deploy a Laravel PHP app

Ryan McCullagh on

In this tutorial, we will deploy a Laravel application with a Redis backed queue, a MySQL database, and Nginx web server running PHP 7.4. We’ll also setup continuous deployments from GitHub and automated database backups


Step 1. Creating the PHP server instance

We’ll launch a 512MB/1 Core instance of Ubuntu 16.04 with MySQL, Redis, and PHP 7.4 installed only. Instances on Amezmo are memory efficient Docker containers with private subnets. Create your free account, or login to Amezmo, and then head over to the Instances tab and click the Launch button.

The name field will be the instances internal hostname, which will be pingable from any other instance in your subnet. If you choose to create a dedicated database instance in the future, you can connect them both. After filling out the form, press the next button.

We’ll choose our server configuration and choose PHP 7.4, Redis, and MySQL. You may optionally choose to use another PHP version such as 7.2 or, 7.3. Choosing Redis with allow us to run our queue efficiently. Click finish, and wait for the instance to launch, which should take about 30 seconds.

Installing dependencies

Laravel applications need Composer. Please see the documentation on how to install dependencies with a deployment hook.

Step 2. Importing your repository and setting up automatic deployment

We’ll import our repository from GitHub and setup automatic deployments. The first step is to authorize your account from the tab shown below.

Click on the Continue to GitHub button, and you’ll be directed to GitHub. Amezmo requests the minimal set of permissions in order to properly setup automatic, zero-downtime deployments. After authorizing, you’ll be presented with a screen to choose your repository.

Press the “Next” button and we’ll be presented with a dropdown list of your GitHub repos. Let’s choose your Laravel repository,

Now that we’ve chosen our repository, we’re ready to complete the last step. This last step controls automatic deployments. Choose yes to have Amezmo automatically deploy your app when you push. Deployments on Amezmo are atomic and do not cause any downtime.

We’ve reached the last step of importing our repository and we’re almost done. Once we click the Finish button, we’ll see the progress of our import. As a result of importing this repository, the backend has done the following:

  • Upload a unique Deployment SSH Key to your repo which can be seen in your repository settings on GitHub
  • Create WebHook at GitHub
  • Setup automatic deployments

Once the wizard completes, and the progress bar is done, you’ll be directed the deployments tab where you’ll see the exact steps of the deployment process.

In this post, we’ve successfully deployed a Laravel PHP app with automatic deployments.

Host and Deploy Your PHP Apps for Free
Sign up today and see if Amezmo is right for you.
Read more from Laravel