Moe

Moe El Majnioui


Full-Stack developer
IT Consultant.
OSS
Share: 

Self-Host Your Website with Coolify and Hetzner

I’ve always had this vision hosting my Next.js sites on my own terms, far away from the clutches of Netlify, Vercel, or Render. But how? Then, as I was casually scrolling through X (aka Twitter’s alter ego), bam! I spot people raving about Coolify. It was like finding the cheat code in a game! So, what’s this Coolify magic all about?

What is Coolify?

Coolify is a free, open-source tool that allows you to easily self-host applications, databases, or services (like WordPress, Formbricks, and Grafana) without needing to manage servers yourself.

Why Choose Hetzner?

Two words: wallet-friendly. 💸 Plus, Hetzner recently added a one-click install for Coolify, which makes setting it up a breeze like literally zero hassle.

What You Need Before We Dive In

Make sure you have these goodies:

Step 1: Setting Up Your Domain

For domains, I recommend Porkbun or Namecheap because they’re easy on the wallet and reliable. No one likes spending more than they have to, right?

Step 2: Create a Hetzner Server

Sign in to Hetzner, and here’s what you need to do:

  1. Go to Project > New Project, give it a name (something snazzy), and click Add Project.
  2. Open the new project, click on Create Resource at the top right, and select Servers.

Image

Server Configuration:

Minimum Specifications for Coolify: 2 vCPUs, 2GB RAM, and 30+ GB storage.

Image

Once configured, click Create and Buy Now.

Step 3: Say Hello to Your Server

Hetzner will email you the IP, username, and password for your server.

Using your terminal, SSH into the server with the following command:


 ssh root@<your-server-ip>

Replace <your-server-ip> with your actual IP. It will ask for the password from Hetzner, and then you’ll be asked to set a new root password. Pick a good one and write it down somewhere no sticky notes, please. 😅

Coolify will automatically start installing. You’ll get a link to the dashboard, which will look something like this:


 http://<your-server-ip>:8000

Image

Step 4: Finish Up the Coolify Setup

Follow these steps in the Coolify dashboard:

  1. Open the link to your Coolify instance and complete the registration.
  2. Click Get Started and just keep following the prompts it’s all smooth sailing.

Image

  1. When prompted, select Localhost as the server.

Image

  1. Name your project and continue to Add Resource. Link your Git repository (using a public one for this example).

Image

  1. Click Check Repository to verify it.

Image

  1. Select localhost when asked which server to use, then proceed to Deploy and let Coolify build and serve your app.

Image

If all went well, your website should be live on the link generated by Coolify.

Image

Step 5: Setting Up a Custom Domain for Coolify

Head over to your domain provider’s dashboard and tweak the DNS settings:

Image

Image

Now, you can access Coolify using your custom domain, hence https://coolify.fplstats.live instead of http://<your-server-ip>:8000. No more IPs to remember!

  1. In Coolify, navigate to your project’s configuration dashboard.
  2. Replace the autogenerated domain with your custom one. Make sure to include both www and non-www versions, separated by commas.

Image

  1. Click Save and then Redeploy to apply the changes.
  2. Now back in your domain’s DNS settings, add A records for both the root domain and www subdomain, pointing to your server IP.

Image Image

Image

Step 7: Set Up a Firewall (Because Security Matters)

For added security, set up a firewall on Hetzner:

  1. Go to Firewalls in the Hetzner dashboard and create three inbound rules for common ports (e.g., 80, 443, and SSH).

Image

  1. Apply these rules to your server under the Resources tab.

Image

  1. Once the firewall is enabled, Coolify will only be accessible via your custom domain https://coolify.<your-domain> plus, HTTPS is all taken care of by Coolify. No need to stress over SSL certificates. 😊

The Grand Finale

And there you have it, folks! We created a Hetzner server, set up Coolify, linked a custom domain, and configured firewall rules. Now you’re all set to self-host like a pro.

Hope this guide helped you out! If you have any questions or just wanna chat about tech stuff, hit me up on X (Twitter): @_Marocain.

, , ,