Reputation: 15
i am trying to deploy my newly created project with laravel 8, Laravel Breeze, and laratrust, to my shared hosting with Hostinger company. In a subdomain.
I have done nothing else yet, other than install these packages.
Domain name: myappdomain.com
Subdomain i am trying to deploy to: testing.myappdomain.com
On my local machine, using "uWamp" OR "php artisan serve", everything works fine. I can login and register fine.
When i upload my project to hostinger's public_html/testing/, laravel's index.php is shown, but i cant access testing.myappdomain.com/login or /register. I get a 404.
here is what i do:
I ziped my whole www/ directory on my local machine and uploaded it to Hostinger, in my public_html/testing folder of my domain.
i unzip the package and move all files back up 1 directory, for them to be well under public_html/testing and NOT public_html/zipFileName/testing
I updated the .env file with new correct values for my domain:
APP_URL=https://testing.myappdomain.com
DirectoryIndex public/index.php
Upvotes: 0
Views: 2602
Reputation: 286
Here the steps to host Laravel application in Shared Hosting.
This is the simplest method if you don't have ssh access. If you have ssh access, you can use github for the deployment.
Edit : If you can't change the document root,
require __DIR__.’/../bootstrap/autoload.php’;
$app = require_once __DIR__.’/../bootstrap/app.php’;
to
require __DIR__.’/../myLaravelProject/bootstrap/autoload.php’;
$app = require_once __DIR__.’/../myLaravelProject/bootstrap/app.php’;
(myLaravelProject is a folder located outside public_html and your laravel project is uploaded to this)
Upvotes: 0
Reputation: 15
I got it working! there was no explicit way of changing document root in hostinger-cpanel. I had to delete the sub-domain and re-create it. By default the cPanel generates document root for you in this manner:
public_html/subdomainName
I had to tick the box "custom folder for subdomain" and change it to
public_html/subdomainName/public
Upvotes: 1