Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

t9dev's avatar
Level 2

How to host TALL app on Hetzner Cloud from a Git Repo ?

I was assigned to host an app to the company server on Hetzner, but it is my first time hosting on this cloud serve, anyone knows how to do that?

Everything is set up, I need to host it from a GitHub Repo to the Server.

I have read this, but does not provide ways to host from GitHub: https://community.hetzner.com/tutorials/deploy-laravel-on-hetzner-cloud

0 likes
34 replies
JakeCausier's avatar
Level 6

Once you get to step 7, you would set up your Github repository in place of where you would install Laravel. This is the same with any cloud provider and webhost.

Here is a guide on cloning and pulling in changes from a Github repo: https://docs.github.com/en/get-started/using-git/getting-changes-from-a-remote-repository

This doesn't take into account access setup like SSH keys to access private repositories. That is outlined here: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh

Once the project is deployed on the server, you will need to install the Composer dependencies to ensure Laravel is working. You'd do that by using cd to access the folder you just cloned your Github repository from, and then running composer install.

Services like Laravel Forge and Ploi handle a lot of this logic on the server for you and makes deploying sites and pulling changes from Github very easy. I would recommend them if you're not 100% on what you're doing.

1 like
t9dev's avatar
Level 2

@JakeCausier , Thank you, it works, find but how can I upload the .env file, since it's not in the repo?

Sinnbeck's avatar

@t9dev You make one on the server and edit it with the correct credentials

Run

cp .env.example .env
php artisan key:generate
t9dev's avatar
Level 2

@Sinnbeck , I got this error. cp: cannot stat '.env.example': No such file or directory

Sinnbeck's avatar

@t9dev Oh seems that someone deleted it then? Its default in laravel. Normally you keep it up to date with the normal .env (without any passwords etc) so people can easily use it as a template

https://github.com/laravel/laravel/blob/9.x/.env.example

So Instead type

touch .env

And then open it with nano or vim, and add what you need

And run

php artisan key:generate
1 like
t9dev's avatar
Level 2

@Sinnbeck , great. I have done what you said and now a new Apache error Not Found The requested URL was not found on this server. Is it because I did the wrong URL ?

APP_URL=http://95.217.***.***/public
Sinnbeck's avatar

@t9dev No laravel does not need that to serve the url. Are you sure you set apache to point to /path/to/laravel/public

t9dev's avatar
Level 2

@Sinnbeck , not sure. But it says I need to install the project in var/www/html.

Sinnbeck's avatar

@t9dev Yeah that guide isnt very good. You need to actually set up a virtual host file that points to your app. You should never have /public in the url

t9dev's avatar
Level 2

@Sinnbeck , and how to do that, is there any tutorial to watch or read for it ?

t9dev's avatar
Level 2

@Sinnbeck , Done, now it redirects correctly to the app routes but still shows the same 404 error message :(

t9dev's avatar
Level 2

@Sinnbeck

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName onboarding
    ServerAlias www.minPlanonboarding
    DocumentRoot /var/www/onboarding/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I don't have a domine yet, still using the IP Address only.

Sinnbeck's avatar

@t9dev that might mean it's still using the default. Try adding the ip as ServerName and restart apache

t9dev's avatar
Level 2

@Sinnbeck , I tried to create a index.html file and it displays the content perfectly, but the index.php causes the error, any idea ?

Sinnbeck's avatar

@t9dev can you try

sudo a2enmod php8.0

Check php version with php -v if in doubt

Sinnbeck's avatar

Maybe try sudo apt install php8. 1-common

1 like
t9dev's avatar
Level 2

@Sinnbeck , I tried to install a new Laravel project and it works fine, so I tried to use the same public fill on my project, yet the same problem occurs.

Sinnbeck's avatar

@t9dev if it works with a new laravel installation but not the one from the github repo then apache is working. Can you share the url perhaps? Or at least the exact error message

t9dev's avatar
Level 2

@Sinnbeck , tried every npm command, still , error message

/var/www/onboarding/node_modules/vite/bin/vite.js:2
import { performance } from 'node:perf_hooks'
       ^

SyntaxError: Unexpected token {
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ build: `vite build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-10-10T19_27_34_480Z-debug.log
Sinnbeck's avatar

@t9dev I have seen that error before but have no clue what it means. Did you run npm install?

Sinnbeck's avatar

@t9dev and npm run build still throws that error? What node version are you running?

t9dev's avatar
Level 2

@Sinnbeck , how to install the latest node version? It's v10.19. Maybe this is the problem..

Sinnbeck's avatar

@t9dev if everything is solved, please mark a best answer to set the thread as solved

1 like

Please or to participate in this conversation.