All Collections
VPS
VPS OS and Templates
How to Use the Laravel VPS Template
How to Use the Laravel VPS Template

Getting started with the Laravel VPS template at Hostinger

Updated over a week ago

Laravel is a robust PHP framework designed for developers who need a simple and elegant toolkit to create full-featured web applications. Hostinger's Ubuntu 22.04 64bit with Laravel VPS template simplifies the Laravel setup by coming pre-installed with Laravel on the CloudPanel control panel and Composer, PHP's dependency manager.

This guide will walk you through the basics of getting your Laravel project up and running on this template.

Accessing CloudPanel

Open a web browser and navigate to https://your-vps-ip:8443. Make sure to replace your-vps-ip with the actual IP address of your VPS. Use the credentials you provided during template installation to log in to the CloudPanel interface:

Accessing CloudPanel

Exploring Laravel's Structure

Laravel has a specific structure for its directories and files. Familiarize yourself with the MVC (Model-View-Controller) architecture and where to locate routes, controllers, models, and views within your project:

Exploring Laravel's structure in the file manager

Configuring Your Laravel Environment

Edit the .env file in your Laravel project root to configure your application environment, such as database connections, mail drivers, and more:

Editing the .env file in Laravel's project root folder

Ensure you've set an application key using the php artisan key:generate command, which is critical for securing your Laravel application:

Setting an application key for security

Managing Your Laravel Project with Composer

Use SSH to connect to your server. You might need terminal access to run Composer commands directly in your project directory. To access the default project, connect through SSH with a username user and password you have set during template installation.

Within your project directory, you can use Composer to manage dependencies. For example, to update your Laravel project dependencies, run composer update:

Updating your Laravel project dependancies via Composer

Running Migrations and Seeding Database

Run php artisan migrate to migrate your database using Laravel's migration system.

If you have database seeds set up, run php artisan db:seed to populate your database with initial data.

If you want Laravel to run on your domain, point it to your VPS IP address, change the server hostname, and reinstall the server 💡

The Ubuntu 22.04 64bit with Laravel VPS template provides a convenient starting point for Laravel developers. By leveraging the power of CloudPanel and Composer, you can focus on developing your application instead of worrying about server setup and maintenance. Remember, Laravel is a framework that rewards those who take the time to learn its intricacies and best practices.

For more detailed guides on Laravel development, refer to the official Laravel documentation.

Did this answer your question?