I've built a Laravel site locally, and everything works wonderfully—but when I've tried deploying it to my shared host (Hostinger), I cannot get everything replicated or set up correctly. The obvious problem is that Hostinger puts the public-facing code in a public_html
folder, which my Laravel setup does not have (it has public
instead).
Also, I'm using GitHub for version control and (hopefully) deployment. I'm able to connect my GitHub repo directly in Hostinger, but the problem is, it pulls my code into public_html instead of the root.
I'm really sorry if this question/problem is dumb; I'm more of a web designer than developer these days, and I just need a damn portfolio site up and running. :)
Local directory structure:
root
--app
--bootstrap
--config
--database
--node_modules
--public
--resources
--routes
--storage
--tests
--vendor
I've read various articles and posts about either copying contents of public
into public_html
after uploading the code, and then changing __DIR__
suffixes in index.php
; or ways to change public
to public_html
locally up front...but the former didn't work and the latter scares me since so much of my Laravel workflow using npm run
and whatnot utilizes the public
dir.
I also don't really want to have my remote and local out of sync. My desired workflow:
code locally <---
| |
npm run dev/watch --
|
npm run prod
|
push to GitHub
|
deploy to host
|
enjoy fresh website without any changes to remote files on host :)