{"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-03-16T12:12:08","modified_gmt":"2026-03-16T12:12:08","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":"<p class=\"no-margin\">While it&rsquo;s possible to <b><a href=\"\/support\/1583296-can-i-install-applications-automatically-with-hpanel\" target=\"_blank\" class=\"intercom-content-link\">install Laravel automatically<\/a><\/b>, you might want a version that is not on the list. Keep in mind that it&rsquo;s always recommended to have the <b><a href=\"https:\/\/laravel.com\/docs\/9.x\/releases#support-policy\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">current stable version<\/a><\/b> installed to avoid any security threats or bugs. <\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">If you still choose Laravel 8, you should proceed with a manual installation: <\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_3b86ca5bdd\">Step 1 &ndash; Preparations<\/h2><p class=\"no-margin\">Before starting, you will need to <b><a href=\"\/support\/4598546-how-to-set-up-my-orders-at-hostinger\" target=\"_blank\" class=\"intercom-content-link\">activate your hosting plan<\/a> <\/b>and <b><a href=\"\/support\/1583214-how-to-add-a-domain-to-my-account-how-to-add-website\" target=\"_blank\" class=\"intercom-content-link\">add a domain<\/a><\/b> on which you want to have Laravel. <\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_17fd19fcb5\">Step 2 &ndash; Upload and Move the Files <\/h2><p class=\"no-margin\">Using any suitable option, <b><a href=\"\/support\/1884234-how-to-upload-backup-at-hostinger\" target=\"_blank\" class=\"intercom-content-link\">upload your Laravel website&rsquo;s files<\/a><\/b> to the website&rsquo;s files, 1 level above <b>public_html<\/b>. If your project is named <b>laravel<\/b>, your file structure will look like this: <\/p><p class=\"no-margin\">\n<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"https:\/\/blog.hostinger.io\/pt\/support\/wp-content\/uploads\/sites\/59\/2023\/01\/1c40f339-2293-469b-9b9f-e6ade3bc2447.jpg\" alt=\"The File Manager showing the structure of a laravel project\"><\/div><p class=\"no-margin\">After this, open <b>laravel\/<\/b> folder and move all files from it to <b>public_html<\/b>: <\/p><p class=\"no-margin\">\n<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"https:\/\/blog.hostinger.io\/pt\/support\/wp-content\/uploads\/sites\/59\/2023\/01\/829b9734-6298-48c4-9a5d-cb3d1dc724c5.jpg\" alt=\"The Move files window indicating to move to public_html\"><\/div><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_263586eb90\">Step 3 &ndash; Create .htaccess File<\/h2><p class=\"no-margin\"><a href=\"\/support\/1583307-how-to-create-an-htaccess-file\" target=\"_blank\" class=\"intercom-content-link\">Create the <b>.htaccess<\/b> file<\/a> and add the following rule so that Laravel loads content correctly:<\/p><p class=\"no-margin\">\n<\/p><pre><code>&lt;IfModule mod_rewrite.c&gt;<br>  RewriteEngine On<br>  RewriteRule ^(.*)$ public\/$1 [L]<br>&lt;\/IfModule&gt;<\/code><\/pre><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">If your website uses databases\/models, you will see a Laravel Database connection error. We&rsquo;ll fix it in the next step. <\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_489752cdb8\">Step 4 &ndash; Update Database Information<\/h2><p class=\"no-margin\">If Models are running on your application, you will have to migrate tables to the database. You have two alternatives:<\/p><p class=\"no-margin\">\n<\/p><h3 id=\"h_334ef4f862\">MySQL<\/h3><p class=\"no-margin\">To use MySQL, start by <b><a href=\"\/support\/1583542-how-to-create-a-new-mysql-database\" target=\"_blank\" class=\"intercom-content-link\">creating a new database<\/a><\/b>. Next, open the <b>.env<\/b> file and update your database information. It should look like this: <\/p><p class=\"no-margin\">\n<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2022\/04\/b35c51da-cec0-49e4-a38c-39ea6e5ea67d.jpg\" alt=\"The File Manager showing a .env file with data to connect a MySQL database\"><\/div><h3 id=\"h_1017fdd741\">SQLITE<\/h3><p class=\"no-margin\">If you want to use SQLITE, go to the File Manager, navigate to <b>database\/<\/b>, and create the <b>database.sqlite<\/b> file. Next, open the <b>.env<\/b> file and update your database information. Just copy the <b><a href=\"\/support\/1583494-what-is-the-path-to-my-root-home-directory-how-can-it-be-changed\" target=\"_blank\" class=\"intercom-content-link\">path to your root directory<\/a><\/b> and change <b>public_html<\/b> to <b>database\/database.sqlite<\/b>. It should look like this: <\/p><p class=\"no-margin\">\n<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"https:\/\/blog.hostinger.io\/pt\/support\/wp-content\/uploads\/sites\/59\/2023\/01\/cef96bbd-66cc-4878-8a31-af9156a9ebbc.jpg\"><\/div><h3 id=\"h_9bbdc41a2f\">Migrate the Tables<\/h3><p class=\"no-margin\">Once you have created the database with either method, <b><a href=\"\/support\/1583245-how-to-connect-to-your-account-via-ssh\" target=\"_blank\" class=\"intercom-content-link\">connect to your account via SSH<\/a><\/b>, navigate to your <b>laravel<\/b> directory, and enter the following command to migrate all the files to a database: <\/p><p class=\"no-margin\">\n<\/p><pre><code>php artisan migrate<\/code><\/pre><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">That&rsquo;s it. Your Laravel 8 website should work now &#128522; <\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><b>NOTE<\/b><\/p><ul>\n<li>\n<p class=\"no-margin\">To <b>set up an artisan cronjob<\/b> for scheduling actions of your application, <b><a href=\"\/support\/1583465-how-to-set-up-a-cron-job-at-hostinger\" target=\"_blank\" class=\"intercom-content-link\">create a custom cronjob<\/a><\/b> using this code template:<br>&#8203;<\/p>\n<pre><code>\/usr\/bin\/php \/home\/u12345678\/domains\/domain.tld\/public_html\/artisan schedule:run<\/code><\/pre>\n<p class=\"no-margin\">Replacing <b>u12345678<\/b><i> <\/i>and <b>domain.tld<\/b><i> <\/i>with your data.<\/p>\n<\/li>\n<\/ul><p class=\"no-margin\"><b>Additional Resources<\/b><\/p><ul>\n<li>\n<p class=\"no-margin\"><b><a href=\"https:\/\/laravel.com\/docs\/8.x\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">Laravel 8.x Official Documentation<\/a><\/b><\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Deploying Laravel 8 on Web and Cloud hosting at Hostinger<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[266],"tags":[],"class_list":["post-956","post","type-post","status-publish","format-standard","hentry","category-installing-applications"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/6152127-how-to-deploy-laravel-8-at-hostinger\/","default":1},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/support\/6152127-como-implementar-laravel-8-en-hostinger\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/6152127-comment-deployer-laravel-8-chez-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/6152127-bagaimana-cara-deploy-laravel-8-di-hostinger\/","default":0},{"locale":"lt-LT","link":"https:\/\/www.hostinger.com\/lt\/support\/6152127-kaip-idiegti-laravel-8-naudojantis-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/6152127-como-implantar-deploy-o-laravel-8-na-hostinger\/","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/6152127---laravel-8--hostinger\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/956","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=956"}],"version-history":[{"count":1,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/956\/revisions"}],"predecessor-version":[{"id":3881,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/956\/revisions\/3881"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=956"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}