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

guide

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

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

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

Forgejo is a popular open-source, self-hosted Git service that enables developers to manage their code repositories effectively. This guide will show you how to install and configure Forgejo on a Contabo VPS, ensuring that you maximize your serverโ€™s performance while keeping everything secure.

Why Choose Contabo for Self-Hosting?

Contabo offers competitive pricing and robust infrastructure, making it an attractive option for self-hosting applications like Forgejo. Hereโ€™s a quick comparison of some popular VPS providers:

ProviderPrice (EUR/USD)FeaturesPerformance
Contabo VPS5.99 EUR/moSSD storage, high bandwidthHigh
Hetzner Cloud4.15 EUR/moReliable performance, easy setupMedium
DigitalOcean6 USD/moSimple interface, scalable optionsHigh
Vultr6 USD/moWide server locations, user-friendlyHigh
Linode (Akamai)5 USD/moExcellent support, fast storageHigh

For detailed comparisons, check our full VPS comparison.

Prerequisites

Before you start, ensure you have:

  1. A Contabo VPS with at least 2 GB RAM (recommended).
  2. Basic knowledge of SSH and command line interface.
  3. A domain name to link to your Forgejo instance (optional).

Step 1: Setting Up Your Contabo VPS

  1. Log in to your Contabo VPS:

    • Use SSH to connect:
      ssh root@your_vps_ip
  2. Update your system:

    apt update && apt upgrade -y
  3. Install essential packages:

    apt install curl git -y

Step 2: Install Docker

Forgejo runs efficiently using Docker. To install Docker, follow these steps:

  1. Install Docker:

    curl -fsSL https://get.docker.com -o get-docker.sh
    sh get-docker.sh
  2. Add your user to the Docker group (optional for non-root usage):

    usermod -aG docker $USER
  3. Verify Docker installation:

    docker --version

Step 3: Deploy Forgejo Using Docker

  1. Create a Docker network:

    docker network create forgejo
  2. Create a directory for Forgejo data:

    mkdir -p /opt/forgejo/{data,logs}
  3. Create a docker-compose.yml file:

    nano /opt/forgejo/docker-compose.yml

    Add the following content to your docker-compose.yml file:

    version: '3'
    
    services:
      forgejo:
        image: forgejo/forgejo:latest
        restart: always
        networks:
          - forgejo
        ports:
          - "3000:3000" # Forgejo web interface
        volumes:
          - ./data:/data
          - ./logs:/logs
        environment:
          - SECRET_KEY_BASE=your_secret_key_base
          - APP_URL=http://your_domain_or_ip:3000

    Replace your_secret_key_base with a secure key generated using:

    openssl rand -hex 32

Step 4: Start Forgejo

  1. Navigate to the Forgejo directory:

    cd /opt/forgejo
  2. Run the Forgejo container:

    docker-compose up -d
  3. Check the logs to ensure it started successfully:

    docker-compose logs -f

Step 5: Accessing Forgejo

  1. Open your web browser and navigate to:

    http://your_domain_or_ip:3000
  2. You will be greeted by the Forgejo setup page. Follow the prompts to create your admin account.

FAQs

How secure is Forgejo when self-hosting on Contabo?

Self-hosting Forgejo on Contabo is relatively secure if best practices are followed. Always use a strong secret key and enable HTTPS for your Forgejo instance. You can use a reverse proxy like Nginx to handle SSL termination. Regularly update your Docker images and the Forgejo application to patch vulnerabilities.

What are the main advantages of using Forgejo?

Forgejo offers several advantages including a user-friendly interface for managing repositories, issue tracking, and CI/CD integration. Additionally, being self-hosted means you have full control over your data and repositories, which is paramount for developers concerned about privacy and data security.

How do I back up my Forgejo data?

Backing up your Forgejo data is crucial to prevent data loss. Since Forgejo uses Docker, you can back up your data by creating a tarball of the data directory. Execute the following command:

tar -czvf forgejo_backup.tar.gz /opt/forgejo/data

Consider automating this backup process through cron jobs to ensure regular backups without manual intervention.

Following this guide should lead to a successful setup of Forgejo on your Contabo VPS. If youโ€™re looking to explore more self-hosted solutions, visit the r/selfhosted subreddit or the awesome-selfhosted GitHub repository for additional resources. Happy hosting!