This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Introducing Cloudways Community Forum. Start Discussions and Get Instant Help From Cloudways Community. JOIN NOW

Deploy Your Laravel Application on Cloudways ServerNovember 19, 2018

 

In this KB

  • Create a Laravel application on an existing server
  • Deploying code from a repository
  • Get SSH access to your application
  • Update Laravel configuration
  • Execute Migration/Seeder
  • Set up Laravel scheduler

 

Laravel is a popular PHP development framework used to build everything from simple ecommerce store backends to enterprise portals. It is an Open Source MVC architecture that allows for rapid application development and continuous integration of the applications.

Developers could take advantage of the modular packaging system (bundles in Laravel) that takes care of application dependencies through a dependency manager known as Composer. Deploying Laravel application is an important aspect of the project cycle that has a far-reaching impact on the functionality and health of the project.

This simple KB will help you deploy Laravel applications on Cloudways managed servers. Note that you can deploy your Laravel application on new or existing servers. For the purpose of this Knowledge Base article, we will use an existing Cloudways server.

Step 1: Install Laravel Application

After logging into the Cloudways Platform, click on Servers in the top menu bar and select the target server on which you want to deploy the Laravel application.

Now at the bottom right, click on the circular grid icon, and select Add App for creating a new application.

Select the Laravel application and click on Add Application button. This will take a few minutes for the setup to complete.

Step 2: Deploy the Application from a Repository

Select the application installed in Step 1, and go to the Application Manager. Click Deployment via Git.

Add the Remote Repo URL in the Git Remote Address field and click on the Authenticate button. This will clone your application on the Cloudways server.

Step 3: SSH to Your Server

Go to the Server Manager and click the Launch SSH Terminal button. This will open the terminal to the server.

Provide the Master Credentials (username and password) available on the Server Management page.

Step 4: Run the  Composer

In the terminal, go to the application and then to the public_html folder.

cd application/[applicationName]public_html

Execute the Composer Update command for updating the dependencies of the Laravel application. Note that your application folder name is mentioned on the Access Detail Page.

composer update

Step 5: Update the Environment Configurations

Open the .env file and update the necessary configuration changes such as application name and database information.

Step 6: Execute Database Migration and Seeder [OPTIONAL]

If you already have a database for your Laravel application and you are deploying it for the first time on a Cloudways managed server, you will need to migrate and seed the database.

For this, use the following commands:

php artisan migrate:fresh

 

php artisan db:seed

Once the process finishes, you can double-check the steps by clicking the Launch Database Manager button.

Step 7: Set up Laravel Scheduler

When you need a scheduler for the Laravel application, you only need to add a cron entry to your server. For this, you need to go to the Cron Job Management and click on Advanced. Now add the following script, and click Save.

*  *  *  *  *  /home/[serverFQDN]/[AppUsername]/public_html artisan schedule:run  #CloudwaysApps

That’s it, you have deployed your Laravel application on the Cloudways server.

Happy Coding!

 

Please insert Content
Have Questions? Ask From Our Helpful Community

Comments are closed.

Do you still need help?

Our Technical Support team is always at work.