Get Rewarded! We will reward you with up to €50 credit on your account for every tutorial that you write and we publish!

Next.js auf einem Webhosting oder Managed Server betreiben

profile picture
Author
just-read-the-instructions
Published
2025-03-26
Time to read
3 minutes reading time

Einführung

In diesem Tutorial werden wir eine Next.js Anwendung auf einem Managed Server für produktive Workloads bereitstellen.

Voraussetzungen

  • Managed Server oder Webhosting L/XL
  • SSH Zugriff

Schritt 1 - Node.js Version festlegen

Je nachdem, welche Node.js Version deine Next.js Anwendung benötigt, führe einen der folgenden Befehle aus:

# für v20
echo 20 > ~/.nodeversion

# für v22
echo 22 > ~/.nodeversion

# für v24
echo 24 > ~/.nodeversion

Verwende v24 falls du eine neue Anwendung erstellst.

Du kannst die aktuell genutzte Version mit node -v prüfen.

Schritt 2 - Next.js Anwendung erstellen

Wechsle in dein Home-Verzeichnis und erstelle eine neue Next.js Anwendung über folgenden Befehl:

cd "$HOME"
npx create-next-app@latest
cd example-app/ # Ersetze example-app mit dem Namen deiner Anwendung

Alternativ kannst du auch eine vorhandene Anwendung über FTP oder SFTP hochladen oder von deinem Git Repository klonen.

Schritt 3 - Baue deine Next.js Anwendung

Erstelle jetzt einen Production Build mit

npm run build

Schritt 4 - Konfiguriere die Anwendung in der konsoleH

Konfiguriere die Anwendung nun im Node.js Menü der konsoleH. Trage hier folgende Werte in das Formular ein:

Skript-Pfad: node_modules/.bin/next
Arbeitsverzeichnis: example-app/
Log-Pfad: example-app/log.txt
Arbeitsspeicher-Beschränkung: 1024 MB
Version: 24

Füge als "Übergabeparameter" start hinzu.

Klicke abschließend auf den Button Aktivieren.

Schritt 5 - Test

Öffne deine Domain in deinem Browser und du solltest deine Next.js Anwendung sehen.

Ergebnis

Du hast nun ein 'production ready' Deployment deiner Next.js Anwendung.

License: MIT
Want to contribute?

Get Rewarded: Get up to €50 in credit! Be a part of the community and contribute. Do it for the money. Do it for the bragging rights. And do it to teach others!

Report Issue

Discover our

Managed Servers

Focus on your projects. We'll take care of the configuration and updates.

Want to contribute?

Get Rewarded: Get up to €50 credit on your account for every tutorial you write and we publish!

Find out more