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.
If you don't have a VPS yet, consider purchasing one of our Laravel VPS hosting plans to proceed 🚀
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:
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:
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:
Ensure you've set an application key using the php artisan key:generate
command, which is critical for securing your Laravel application:
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
:
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.