RunCloud makes it easy to deploy and manage web applications on any cloud provider using Laravel – a popular PHP framework that provides a simple and elegant way to create web applications.

Here are the step by step instructions for installing Laravel on RunCloud:

  1. Log in to your RunCloud dashboard and create a new web application. Give it a name, set the web application owner, select a domain name, and configure backup settings.
  1. Laravel 10 requires PHP 8.1 and above. In the Basic settings section, select PHP 8.2 and leave the other settings as default. Click “Deploy” Web Application to proceed.
  1. Log in to your server via SSH as the owner of the web application. Refer to our post about SSH on RunCloud to learn how to do this.

  2. After logging in, navigate to the web root directory of your web application using the cd command. You can find the root path of your application in your RunCloud dashboard.

    For example, if your web application name is laravel-app, you can use the following command: cd /home/runcloud/webapps/laravel-app

  3. Delete the existing index.html file using the rm command. This file is a placeholder that RunCloud creates for every web application. You can use the following command: rm index.html
  1. RunCloud installs multiple PHP versions on your server. To ensure that Laravel uses the correct PHP during installation, we will specify the complete path of the PHP executable. The PHP 8.2 executable is located at:

    • On Nginx: /RunCloud/Packages/php82rc/bin/php
    • On OpenLiteSpeed: /usr/local/lsws/lsphp82/bin/php

  2. If you are using a different version of PHP, you can run the following commands to get a list of all the PHP and composer binaries on your server:
sudo find / -wholename *bin/php
sudo find / -wholename *bin/composer
  1. After locating your executable binaries, you can install Laravel using Composer, a dependency manager for PHP.

    We will use the composer create-project command to create a new Laravel project in the current directory and specify the --prefer-dist option to download the latest stable version of Laravel. Here is the syntax of the command:
<path to php> <path to composer> create-project --prefer-dist laravel/laravel .

Replace the <path to php> and <path to composer> with the output from the step 7. Here is an example of the resulting command using PHP 8.2.

# For Nginx
/RunCloud/Packages/php82rc/bin/php /usr/sbin/composer create-project --prefer-dist laravel/laravel .

# For OpenLiteSpeed
/usr/local/lsws/lsphp82/bin/php /usr/sbin/composer create-project --prefer-dist laravel/laravel .
  1. Wait for Composer to finish installing Laravel and its dependencies. This may take a few minutes depending on your internet speed and server resources.

  2. Go back to your RunCloud dashboard and configure SSL for your domain. You can use Let’s Encrypt, a free and automated SSL certificate provider, or upload your own custom SSL certificate.

  3. Finally, go to the “Settings” tab of your web application and change the public path of your web application to include /public at the end. This is because Laravel stores its public files, such as images, CSS, and JavaScript, in the public directory. You also need to change the application type to Laravel, so that RunCloud can apply the appropriate Nginx rules for Laravel. Click “Update Stack” to save your changes.
  1. That’s it! You have successfully installed Laravel on RunCloud. You can now visit your domain name in your browser and see the Laravel welcome page. You will also see an additional Laravel section that contains settings specific to Laravel web applications.

If you have any questions or need any help with installing Laravel on RunCloud, please let us know in RunCloud community.