F
Filament14mo ago
th3ja

Hostinger Shared Hosting subdomain for admin panel

Hello everyone, nice to meet you! Would really appreciate your help if you have the time! I've chosen Hostinger's Shared Hosting Plan for my project. I've successfully setup the "front-end" with Jetstream on the main domain. What I'm trying to do: Use a subdomain exclusively for filament without the need of creating a new project inside the subdomain's directory. It's worth noting that everything lives within the same app.
What I did:
class AdminPanelProvider extends PanelProvider {
public function panel(Panel $panel): Panel {
return $panel
->default()
->id('admin')
->path('')
->domain(env('ADMIN_URL'))
class AdminPanelProvider extends PanelProvider {
public function panel(Panel $panel): Panel {
return $panel
->default()
->id('admin')
->path('')
->domain(env('ADMIN_URL'))
I've set up the subdomain as an env variable that I've configured within the production env. Not sure is this is the correct way to work in production because it works as expected locally. ✅ I've implemented the UserContract in the User model The error: 403 forbidden Below is a snippet of the project's root .htaccess that i've attempted with no luck
apache
RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain\.yourdomain\.com [NC]
RewriteRule ^(.*)$ public/$1 [L]
apache
RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain\.yourdomain\.com [NC]
RewriteRule ^(.*)$ public/$1 [L]
Solution:
Wow I feel like an idiot. It wasn’t pointing to the project’s public folder. Filament is up & running now on subdomain as expected. Thank you both so much. And sorry for the trouble. P.d. I will probably be asking more help along the way 😅...
Jump to solution
11 Replies
Dennis Koch
Dennis Koch14mo ago
1. Shared Hosting is never recommended for Laravel 2. Never use env() inside your project. It must only be used in config files. Is the 403 coming from Laravel or Apache? Can't tell much about your Apache config.
th3ja
th3jaOP14mo ago
1. Got it! The reason behind it was for economic reasons 2. Noted! Thank you! Sorry about that. 403 coming from Apache. I believe it’s for the same reasons I had it on initial deploy before adding the .htaccess in root. The only major change for apache config was adding the project root .htaccess on deploy.
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
This is all I had for the initial deployment that is running correctly. Not trying to blow up your notifications or bother you, just making sure you know I answered. Thanks for replying btw!
awcodes
awcodes14mo ago
You can use a digital ocean droplet or even Aws for less than $5 a month. Shared hosting. As far as I’m concerned is never an option.
th3ja
th3jaOP14mo ago
Yup! Digitalocean is also juicy. For this and other reasons, client decided to go with hostinger. Sorry, the last part of “is never an option”, what are you referring to? Thanks in advance.
Dennis Koch
Dennis Koch14mo ago
It’s just a hassle to set up. Most of them don’t even allow to set the DomainRoot. Is the subdomain at all working? Did you try with a simple html file or similar? The subdomain is also pointing to the public folder?
th3ja
th3jaOP14mo ago
After some research, I found that there’s a specific line in Digitalocean droplets where it is still shared hosting. You have to have specific specs for it to be private and it is a bit of $. 1. Subdomain working correctly 2. Would I have to symlink it to public folder?
Dennis Koch
Dennis Koch14mo ago
No symlink. It should just point to the public folder as the main domain should
th3ja
th3jaOP14mo ago
Oh ok! So to the public_html where my app is or you mean the public folder of my app?
Solution
th3ja
th3ja14mo ago
Wow I feel like an idiot. It wasn’t pointing to the project’s public folder. Filament is up & running now on subdomain as expected. Thank you both so much. And sorry for the trouble. P.d. I will probably be asking more help along the way 😅
Dennis Koch
Dennis Koch14mo ago
Always the public folder. Anything else is not secure
th3ja
th3jaOP14mo ago
Thanks again!
Want results from more Discord servers?
Add your server