#Simple Hosting

7 messages · Page 1 of 1 (latest)

half grove
#

Hi, may someone can explain me whats really needed to host a simple application with only database access? Is it possible to host in on a classic webhoster? Basically i need to run npm run build and copy everything to the server and it should run? Or what am i missing? In the end, this is just php right?

devout fern
#

it does everything for you, u just press what branch and presss deploy boom

#

i also use hertzner as a VPS best bang for buck

clear sorrel
# half grove Hi, may someone can explain me whats really needed to host a simple application ...

So you can either use a tool like Fatih has mentioned (Coolify or VitoDeploy, which automate the deployment process for you). Or you can rent a VPS, it is up to you who you choose as the service provider, but you should consider their reputation and the servers location (don't think it really affects web apps too much).
If you decide to go with the VPS option, you will have to set everything up yourself, or run a dockerized version of the application. There are plenty of tutorials that walk you through how to setup a Laravel on Ubuntu or other Linux distros, the two main difference you will see is that people either run nginx or apache2 as the web server.
I personally use apache2, they both do the same job so it doesn't matter too much however you will need to write virtual host files.
In order for your web app to work you need to build the front-end (js) and the back-end (php) using the production mode, so for js you need the command "npm run build", and for php "composer install --optimize-autoloader --no-dev", this will only leave the necessary files for the application to work.
For the database you will still need to run the command "php artisan migrate".

half grove
#

Hello, sorry perhaps I was unclear. I am totally aware how it works regarding docker, i also run several laravel applications on coolify & laravel.cloud.
But - and thats what i want to understand - in the end these are PHP files.
So it should also be possible to run it without dockerizing stuff etc, it should be possible to run it on a simple webhoster (Even free ones).
What I already found out: I can copy the whole project to remote, move only the laravel-public folder into the public-remote folder and change the index.php paths - it will run perfectly fine. (Storage symlink).
But what are the disadvantages? I have to run the cache / optimize / etc. commands by myself.

mellow stag
#

Well yeah, in the end it's all PHP. You could also host in on a Raspberry Pi.
The thing with shared hosting (what I think you're referring to), it's not tailored towards Laravel. They're often tailored to plain PHP or wordpress. Deploying is kind of a nightmare, as you've pointed out, you'd need to upload it through FTP. This comes with a lot of complications, like do you just upload your local files? In that case, you'd also be sending dev-dependencies, which you wouldn't install in a production env. The same for lots of other files that are locally present, they might contain references to your local paths, so the risk for errors is significant. Then you could just copy a "clean" app, run all the command manually, but that takes a lot of time and is yet again susceptible to mistakes.
You can of course automate all this, but then there are limitation from hosting itself. Shared hosts are often very locked down, so setting up daemons becomes more troublesome (queue, horizon, inertia ssr etc). And one important thing with Laravel is the ability to change the document root to point to the public folder, which often isn't possible. I've seen so many people that applied "hacks" with htaccess files, but that's a wonky workaround and might open up to exploits as it's potentially possible to access files outside of the public folder