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

guide

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

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

Introduction

Forgejo is a self-hosted alternative to Git service providers, allowing developers to manage their repositories with ease. In this guide, weโ€™ll walk you through the steps to self-host Forgejo on DigitalOcean, one of the leading VPS providers. Whether youโ€™re managing a homelab or want to experiment with open-source applications, this guide will cover everything you need.

Prerequisites

Before diving into the installation process, ensure the following prerequisites are met:

Choosing the Right Droplet

For hosting Forgejo, consider the following DigitalOcean droplet configuration:

PlanMonthly CostCPURAMStorage
Basic Droplet (1GB)6 USD11GB25GB SSD
Standard Droplet (2GB)12 USD12GB50GB SSD
Optimized Droplet15 USD12GB50GB SSD

We recommend at least the Basic Droplet for Forgejo to run smoothly. The next tier offers better performance if you expect moderate usage.

Setting Up the VPS

  1. Create a Droplet: Log into your DigitalOcean account and create a new droplet based on the desired configuration.

  2. Access the VPS: Use ssh to connect to your droplet from a terminal.

    ssh root@your_droplet_ip

Installing Docker

Forgejo operates within a Docker container. Follow these commands to install Docker:

  1. Update the system:

    apt update && apt upgrade -y
  2. Install required packages:

    apt install apt-transport-https ca-certificates curl software-properties-common -y
  3. Add Dockerโ€™s GPG key and repository:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  4. Install Docker:

    apt update
    apt install docker-ce -y
  5. Verify the installation:

    docker --version

Running Forgejo

  1. Pull the Forgejo Docker image:

    docker pull forgejo/forgejo:latest
  2. Create a container:

    docker run -d --name forgejo -p 3000:3000 -p 222:22 \
    -v /srv/forgejo:/data \
    forgejo/forgejo:latest
  3. Access Forgejo: Once the container is running, navigate to http://your_droplet_ip:3000 in a web browser to access the Forgejo interface.

Configuring Forgejo

Securing Your Installation

To enhance your Forgejo installation security, consider:

  1. Setting Up a Firewall: Install UFW if itโ€™s not already installed.

    apt install ufw -y
    ufw allow OpenSSH
    ufw allow 3000
    ufw enable
  2. Using SSL/TLS: Secure your instance by acquiring an SSL certificate. You can use Letโ€™s Encrypt for a free SSL certificate.

FAQs

Q: What is Forgejo?

A: Forgejo is a self-hosted software development platform, offering Git repository management. It allows users to host their own code, collaborate with team members, and maintain full control over their data. It is an excellent alternative to commercial services like GitHub and GitLab, especially for developers seeking an open-source solution.

Q: How long does it take to set up Forgejo on DigitalOcean?

A: Setting up Forgejo on DigitalOcean typically takes around 30 minutes, depending on your familiarity with command-line operations and Docker. The bulk of the time involves provisioning your VPS, installing Docker, and configuring Forgejo. Once youโ€™ve completed the initial setup, you can start using it almost immediately.

Q: Can I use other VPS providers to host Forgejo?

A: Yes, you can host Forgejo on other VPS providers such as Hetzner, Contabo, or Linode. The installation steps are similar, but ensure that you choose a provider that meets Forgejoโ€™s requirements. Additionally, when selecting a VPS provider, consider their pricing and performance characteristics to find the best fit for your needsโ€”check our full VPS comparison for a detailed analysis.

Conclusion

Self-hosting Forgejo on DigitalOcean allows developers to maintain full control of their repositories while enjoying the benefits of a robust platform. This guide provides the groundwork for getting Forgejo running on your VPS, setting you up for success in your software development endeavors. Happy coding!