{"id":956,"date":"2022-04-19T13:51:02","date_gmt":"2022-04-19T13:51:02","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2022\/04\/19\/6152127-how-to-deploy-laravel-8-at-hostinger\/"},"modified":"2026-07-24T10:06:20","modified_gmt":"2026-07-24T10:06:20","slug":"6152127-how-to-deploy-laravel-8-at-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/6152127-how-to-deploy-laravel-8-at-hostinger\/","title":{"rendered":"How to deploy Laravel 8 at Hostinger"},"content":{"rendered":"
While it’s possible to install Laravel automatically<\/a><\/b>, you might want a version that is not on the list. Keep in mind that it’s always recommended to have the current stable version<\/a><\/b> installed to avoid any security threats or bugs.<\/p> If you still choose Laravel 8, you should proceed with a manual installation:<\/p> Before starting, you will need to activate your hosting plan<\/a> <\/b>and add a domain<\/a><\/b> on which you want to have Laravel.<\/p> Using any suitable option, upload your Laravel website’s files<\/a><\/b> to the website’s files, 1 level above public_html<\/b>. If your project is named laravel<\/b>, your file structure will look like this:<\/p> After this, open laravel\/<\/b> folder and move all files from it to public_html<\/b>:<\/p> Create the .htaccess<\/b> file<\/a> and add the following rule so that Laravel loads content correctly:<\/p> If your website uses databases\/models, you will see a Laravel Database connection error. We’ll fix it in the next step.<\/p> If Models are running on your application, you will have to migrate tables to the database. You have two alternatives:<\/p> To use MySQL, start by creating a new database<\/a><\/b>. Next, open the .env<\/b> file and update your database information. It should look like this:<\/p> If you want to use SQLITE, go to the File Manager, navigate to database\/<\/b>, and create the database.sqlite<\/b> file. Next, open the .env<\/b> file and update your database information. Just copy the path to your root directory<\/a><\/b> and change public_html<\/b> to database\/database.sqlite<\/b>. It should look like this:<\/p> Once you have created the database with either method, connect to your account via SSH<\/a><\/b>, navigate to your laravel<\/b> directory, and enter the following command to migrate all the files to a database:<\/p> That’s it. Your Laravel 8 website should work now 😊<\/p> NOTE<\/b><\/p> To set up an artisan cronjob<\/b> for scheduling actions of your application, create a custom cronjob<\/a><\/b> using this code template: Replacing u12345678<\/b> <\/i>and domain.tld<\/b> <\/i>with your data.<\/p>\n<\/li>\n<\/ul> Additional resources<\/b><\/p>Step 1 – Preparations<\/h2>
Step 2 – Upload and move the files<\/h2>
<\/div>
<\/div>Step 3 – Create .htaccess file<\/h2>
<IfModule mod_rewrite.c>\r\n RewriteEngine On\r\n RewriteRule ^(.*)$ public\/$1 [L]\r\n<\/IfModule><\/code><\/pre>Step 4 – Update Database Information<\/h2>
MySQL<\/h3>
<\/div>SQLITE<\/h3>
<\/div>Migrate the tables<\/h3>
php artisan migrate<\/code><\/pre>\n
\n<\/p>\n\/usr\/bin\/php \/home\/u12345678\/domains\/domain.tld\/public_html\/artisan schedule:run<\/code><\/pre>\n