Introduction
In this tutorial we will deploy a Next.js application on a Hetzner Webhosting or Managed Server.
Prerequisites
- Managed Server or Webhosting L/XL
- SSH access
Step 1 - Set Node.js version
Depending on which Node.js version your application requires, execute one of the following commands:
# for v20
echo 20 > ~/.nodeversion
# for v22
echo 22 > ~/.nodeversion
# for v24
echo 24 > ~/.nodeversionUse v24 if you create a new application.
You can check the currently used version via node -v.
Step 2 - Create Next.js application
Change into your home directory and create a new Next.js application via the following command:
cd "$HOME"
npx create-next-app@latest
cd example-app/ # Replace example-app with the name of your appAlternatively, you can upload your existing application via FTP, SFTP or clone it from your Git repository.
Step 3 - Build your Next.js application
Create a production build via
npm run buildStep 4 - Configure the application in konsoleH
Configure the application in the Node.js menu of konsoleH. Enter the following values in the form:
Script path: node_modules/.bin/next
Working directory: example-app/
Log path: example-app/log.txt
Memory limit: 1024 MB
Version: 24
Add start as an Argument.
Finally, click the Enable button.
Step 5 - Test
Open your domain in the browser and you should see your Next.js application.
Conclusion
You now have a production-ready deployment of your Next.js application.