Skip to content

How do I install the Laravel framework?

Laravel can be installed on any Hawk Host shared hosting server, but you’ll first need to set up Composer, which you can do using our guide: How do I add Composer to my hosting account?

Once Composer is installed, you can install Laravel using the following command:

Terminal window
composer create-project laravel/laravel my-project

This will create a new Laravel project in the my-project directory.

Configuring Primary Domain to Load Laravel Project

Section titled “Configuring Primary Domain to Load Laravel Project”

Unfortunately, cPanel does not allow you to modify the document root of your primary domain. We can, however, use symbolic links so that your Laravel project’s public folder is used.

To do this, you’ll need to create a symbolic link from your primary domain’s document root to your Laravel project’s public folder.

For example, if your Laravel project is located at /home/username/my-project, you would create a symbolic link from /home/username/public_html to /home/username/my-project/public.

Terminal window
mv ~/public_html ~/public_html_backup
Terminal window
ln -s ~/my-project/public ~/public_html

Configure Addon Domain to Load Laravel Project

Section titled “Configure Addon Domain to Load Laravel Project”

To configure an addon domain to load your Laravel project, when creating your domain, set the document root to the public folder of your Laravel project. You can use our guide How to create new domains, addon domains, parked domains, and subdomains on how to create your addon domain.

Domain: example.com
Document Root: my-project/public