Knowledge Base

Deploy a Laravel Application to FXRM Hosting

image.png

Installing a Laravel Application

SSH into your web hosting account

Run /usr/bin/install_nvm_and_node.sh

/usr/bin/install_nvm_and_node.sh

This will install the latest stable release

Upload your site into the public_html folder

In the control panel change the web root folder to public_html/public

Configure your .env file

Set your database server to localhost or equivalent (note 127.0.0.1 does not work, it must be "localhost")

Configure the application

php artisan key:generate
php artisan migrate

Redis / Caching

image.png

redis is available as a cache director, you can configure this in the Web Control Panel under Advanced -> Developer Tools

Clear the cache

php artisan cache:clear

Optimize for production

php artisan optimize

To manage the cache, you can run the PHP artisan commands in your project’s working directory. For example, enter the following to remove the stored data:

php artisan cache:clear

Use Automatic Laravel Deployment Tools

Automating Laravel deployment helps save time and effort since without it, the process involves many steps. There are various tools and platforms for this task.

You can use continuous integration/continuous deployment (CI/CD) services like GitHub Actions or software like Jenkins. They let you automate a custom Laravel deployment pipeline.

To set up automation in GitHub Actions, create a .yml file in your project directory. Define the workflow and its trigger event, like pushing the changes to the main branch. Then, write the tasks, steps, and environment variables. Read the GitHub Actions quick start guide to learn more about it.

For example, you can make it so that whenever a user pushes new code changes to the main branch, the .yml file will automatically run the PHP artisan command to generate the application key and update your application.

Please rate this article to help us improve our Knowledge Base.

0 0