All Blog Articles

Coolify Multi Server Setup | How to Host Payload NextJS

Media
Sandro WegmannMay 21, 2025
 Streamlined multi-server architecture for Coolify-managed Payload applications with centralized control.

Welcome to our deep dive into setting up Coolify, specifically focusing on how to host your Payload NextJS applications effectively. This guide will take you through an advanced setup that allows multiple VPS (Virtual Private Servers) to be managed from a single Coolify instance. This setup is not only efficient but also scalable, allowing you to manage different projects seamlessly. Let’s get started!

This article provides a detailed step-by-step written companion to our video tutorial on setting up Coolify across multiple servers for hosting Payload applications. For visual learners or those who prefer following along with video instruction, you can watch the complete guide on YouTube at https://www.youtube.com/watch?v=s0uC-bjiUDE. The video covers the same content but offers additional context and real-time demonstrations of each step in the process.

Table of Contents

Understanding Coolify and Its Capabilities

Coolify is an innovative platform that simplifies the deployment and management of applications, particularly those built with frameworks like Next.js and databases like MongoDB or Supabase. As developers, we often seek ways to streamline our workflows, and Coolify offers just that. It allows you to host multiple applications on your own infrastructure, giving you more control over your projects.

In our previous discussion, we explored a basic setup involving a single VPS running Coolify. However, today, we will elevate that setup to a multi-server configuration, which is particularly beneficial for larger applications or when you need to separate different environments.

Stages of Setting Up Coolify

The setup process can be broken down into three distinct stages:

  1. Basic Setup: One VPS running Coolify with all projects hosted on that server.
  2. Advanced Setup: One VPS for Coolify and additional separate servers for hosting individual projects.
  3. Enterprise Setup: Similar to the advanced setup but includes a load balancer for horizontal scaling and redundancy.

Today, we will concentrate on the second stage, which provides a robust way to manage multiple projects with ease.

Choosing Your VPS Provider

For this setup, we recommend using Hetzner. They offer excellent performance at a competitive price, making them a favorite among developers. Being a German company, they also ensure compliance with GDPR regulations, which is essential for those concerned about data privacy.

Creating Your Servers

Let’s begin by creating two servers. The first will host Coolify, and the second will be designated for your projects. Follow these steps:

  1. Navigate to the Hetzner dashboard and select "Add Server".
  2. Choose Nuremberg as your server location.
  3. Select Ubuntu as the operating system.
  4. For CPU type, opt for a shared CPU unless you require dedicated performance.
  5. Choose the CAX 21 configuration, which provides a good balance of power and cost.

Once configured, name your first server "Coolify" and the second server "Projects One". After confirming your settings, click "Create" for both servers. You should receive an email containing the IP addresses and login credentials for each server.

hetzner-server-confirmation-email.jpg


Accessing Your Servers via SSH

Open your terminal and use SSH to access your servers. You will need to use the command:

ssh root@

Replace with the actual IP address of your server. Upon first login, you'll be prompted to set a new password. Ensure that it is secure, as this is root access to your server.


Installing Coolify

With access to your Coolify server, the next step is to install the Coolify instance. Go to coolify.io and click on "Self Hosted" to find the installation script. Copy this script and paste it into your terminal. This process will take a few minutes to complete.

coolify-installation-process-terminal-output.jpg


Setting Up Your Domain

Once Coolify is installed, you will need to set up a domain for secure access. To do this, follow these steps:

  1. Access your Coolify instance using the public IP address and port 8000.
  2. Create an account using your email.
  3. Go to settings and add a domain.

For the domain, you will need to create an A record in your DNS settings pointing to your server’s IP address. After saving, Coolify will attempt to validate the DNS entry and create an SSL certificate. This may take some time due to DNS propagation.


Adding Your Second VPS (Projects One) to Coolify

Now, let’s integrate the second server into Coolify. Begin by generating a new RSA SSH key:

  1. In Coolify, navigate to "Keys and Tokens" and click "Add".
  2. Select "Generate New RSA SSH Key".
  3. Name this key "Projects One" for clarity.

Copy the public key and move to your Projects One VPS.


Configuring SSH Access

Log into your Projects One server via SSH and navigate to the ~/.ssh/authorized_keys file. Open this file in a text editor (e.g., nano) and paste your public key. Save the changes to allow Coolify to access this server.

coolify-ssh-key-configuration-terminal.jpg


Validating Your Setup

Return to your Coolify instance and add Projects One as a new server:

  1. Click on "Add" under the Servers section.
  2. Enter the server name "Projects One" and the corresponding IP address.
  3. For the private key, select the one you just created.

Click "Continue" to validate and install Docker on the Projects One server. This step is crucial as Coolify uses Docker to manage applications.


Deploying a Project

With everything set up, it's time to deploy a project. Create a new project called "Test Production" and add a MongoDB database:

  1. Select the Projects One server as the hosting environment.
  2. Click "Start" to install MongoDB.

Coolify will SSH into Projects One and set up the database for you. This is a great demonstration of how Coolify streamlines deployment processes.


Conclusion

Today, we explored how to set up Coolify in a multi-server configuration, allowing for efficient management of your Payload NextJS applications. This setup not only enhances your workflow but also prepares your infrastructure for future scaling. In upcoming videos, we will dive deeper into deploying a Payload project in combination with MongoDB, showcasing the full potential of Coolify.

If you have any questions or need assistance, feel free to reach out in the comments below. Happy coding!

FAQ

What is Coolify?

Coolify is a platform that allows you to deploy and manage applications easily, particularly for frameworks like Next.js and databases like MongoDB.

Why should I use Hetzner for my VPS?

Hetzner offers cost-effective and high-performance servers, with the added benefit of GDPR compliance.

How do I set up a domain for Coolify?

You need to create an A record in your DNS settings that points to your server's IP address. Then, configure this domain in your Coolify settings.

Can I scale this setup in the future?

Yes! This setup is designed to be scalable. You can easily add more servers and integrate a load balancer in the future.

What are the benefits of using multiple servers?

Using multiple servers allows for better resource management, redundancy, and the ability to separate different environments or projects.

For more information, check out our resources on Coolify and Payload CMS.