Independent testing Updated April 2026 387 self-hosting guides 5 VPS providers tested

guide

How to Self-Host Forgejo on Hetzner (2026 Guide)

Learn how to self-host Forgejo on Hetzner with a detailed step-by-step 2026 guide covering setup, configuration, and recommended specs for a smooth deployment.

How to Self-Host Forgejo on Hetzner (2026 Guide)

Forgejo is a self-hosted Git service that allows you to manage your repositories seamlessly. It is a perfect choice for developers who want full control over their projects. This guide will walk you through the process of setting up Forgejo on Hetzner, one of the top VPS providers, known for its reliability and affordability.

Why Choose Hetzner for Self-Hosting Forgejo?

Hetzner offers flexible pricing options, robust performance, and high availability. Starting as low as 4.15 EUR/month, you can obtain a VPS with sufficient resources to run Forgejo efficiently. Hereโ€™s a comparison of some top VPS providers:

ProviderMonthly CostCPU CoresRAMStorage
Contabo VPS5.99 EUR48 GB200 GB
Hetzner Cloud4.15 EUR12 GB20 GB
DigitalOcean6 USD11 GB25 GB
Vultr6 USD11 GB25 GB
Linode5 USD12 GB50 GB

Hetznerโ€™s competitive pricing combined with solid performance makes it an ideal choice for self-hosting applications like Forgejo.

Prerequisites

Before you begin, ensure you have:

  1. A Hetzner account โ€“ Sign up here.
  2. A freshly created VPS โ€“ For hosting Forgejo, a basic plan with at least 2 GB of RAM is recommended.

Step-by-Step Installation of Forgejo on Hetzner

Step 1: Access Your VPS

Use SSH to connect to your newly created VPS:

ssh root@<your-vps-ip>

Step 2: Update Your System

Once connected, itโ€™s best to update your package repository and upgrade your installed packages. Run the following commands:

apt update && apt upgrade -y

Step 3: Install Required Dependencies

Next, we need to install some necessary packages, including Git, Curl, and Docker. Run:

apt install git curl docker.io docker-compose -y

Enable and start Docker:

systemctl enable docker
systemctl start docker

Step 4: Create Forgejo Configuration

Create a directory for Forgejo:

mkdir -p /opt/forgejo

Now, create a docker-compose.yml file to define the Forgejo service:

version: '3.8'
services:
  forgejo:
    image: forgejo/forgejo:latest
    restart: unless-stopped
    ports:
      - "3000:3000"
    volumes:
      - forgejo_data:/data
    environment:
      - SECRET_KEY=your_secret_key_here
      - DB_TYPE=sqlite3

volumes:
  forgejo_data:

Replace your_secret_key_here with a secure string.

Step 5: Start Forgejo

Inside the /opt/forgejo directory, run:

docker-compose up -d

You can check if Forgejo is running with:

docker ps

Step 6: Access Forgejo

Once Forgejo is up and running, access it by navigating to http://<your-vps-ip>:3000 in your web browser. Follow the on-screen prompts to complete the setup.

Frequently Asked Questions (FAQs)

1. What features does Forgejo provide for developers?

Forgejo offers a variety of features that are crucial for developers, including repository management, issue tracking, pull requests, and code reviews. It supports various Git workflows and allows for collaboration among team members, making it an excellent choice for teams of any size. Additionally, the self-hosted nature provides a layer of security and privacy, allowing you to manage your codebase without relying on third-party platforms.

2. How secure is self-hosting Forgejo on Hetzner?

Self-hosting Forgejo on Hetzner can be secure if you follow best practices. This includes keeping your software updated, using SSH keys for access, and configuring firewalls to restrict unwanted access. Hetznerโ€™s data centers are designed with physical security measures in place, and additional security can be implemented through Docker configurations and network settings. Regular backups and monitoring can further enhance your security posture.

3. Can I scale my VPS if my needs increase?

Yes, Hetzner provides the flexibility to scale your VPS as needed. If your Forgejo instance starts to receive more traffic or requires additional resources, you can easily upgrade your VPS to a plan with more CPU and RAM. This scalability ensures that you wonโ€™t outgrow your hosting environment, and you can continue to self-host your applications seamlessly. Always monitor your resource usage to better predict when an upgrade may be necessary.

For a complete overview of VPS options suitable for your needs, visit our full VPS comparison.

Self-host Forgejo on Hetzner for a robust and secure development platform tailored to your personal or team projects. Happy coding!