Back to articles
AI & Cloud

Deploy Forgejo on VPS: A Lightweight Source Code Management Solution Replacing Gitea

A detailed guide to deploying Forgejo on VPS – a lightweight, high-performance open-source platform for source code storage and management. Covers installation, configuration,...

DPTCloud Engineering4 min read
Deploy Forgejo on VPS: A Lightweight Source Code Management Solution Replacing Gitea

Introduction to Forgejo and Benefits of Deployment on VPS

Forgejo is an open-source platform developed from Gitea, optimized to become a lightweight, high-performance solution for source code storage and management. With a simplified architecture and low system resource requirements, it is ideal for small businesses, development teams, and self-hosted environments with limited VPS RAM. Compared to Gitea, Forgejo offers faster performance, a more user-friendly interface, and better scalability, especially suited for AI and automation workflows.

Deploying on a VPS (High-RAM Cloud VPS for Self-Hosted LLMs & API Gateways) allows full control over source code, ensures data privacy, and enables seamless integration with modern development tools. With a minimum configuration of 2GB RAM and 1 vCPU, it runs reliably on various VPS types, from small servers to cloud VPS with high RAM capacity.

Prerequisites and Pre-Deployment Preparation

To deploy on a VPS, you need:

  • A VPS instance (minimum 2GB RAM, 1 vCPU; recommended 4GB RAM for multiple users)
  • A domain name (e.g., git.yourdomain.com) with DNS records pointing to the VPS IP
  • SSH access to the VPS
  • Node.js (version 16 or higher) and Git installed
  • Database: SQLite (default), or PostgreSQL/MySQL if required

Ensure your system is up to date and install essential tools:

sudo apt update && sudo apt upgrade -y
sudo apt install git curl wget -y

Deployment and Configuration of Forgejo on VPS

Follow these steps to install and configure:

  1. Download and install Forgejo:
    curl -L https://forgejo.org/forgejo-linux-amd64.tar.gz | tar -xzf -
  2. Run the application:
    ./forgejo web
  3. Configure the app.ini file:
    Create the configuration file at /path/to/forgejo/app.ini with the following basic content:
[server]
APP_NAME = Forgejo
DOMAIN = git.yourdomain.com
ROOT_URL = https://git.yourdomain.com/
HTTP_PORT = 3000

Adjust parameters such as DB_TYPE, DB_HOST, and DB_NAME if using PostgreSQL or MySQL.

After configuration, restart using:

./forgejo web --config /path/to/forgejo/app.ini

Activity Verification and Security Hardening

To verify operation, access https://git.yourdomain.com in a web browser. If the login interface appears, Forgejo is running successfully.

To enhance security:

  • Run Forgejo under systemd for automatic startup
  • Enable HTTPS using Let's Encrypt:
sudo certbot certonly --webroot -w /path/to/forgejo/public -d git.yourdomain.com

Ensure the firewall is enabled and only ports 80 (HTTP) and 443 (HTTPS) are open.

For additional guidance, refer to the installation and optimization guide for Open WebUI to integrate with AI applications.

Related infrastructure & engineering guides: High-RAM Cloud VPS for Self-Hosted LLMs & API Gateways

DPTCloud Tier III Infrastructure

High-RAM Cloud VPS Plans Optimized for AI, Databases & Cache

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02Recommended

VPS-4E

297.000 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe
ECO · vn-02

VPS-5E

614.900 ₫ / mo

10% VAT included

  • CPU: 8 vCPU
  • RAM: 16 GB
  • SSD: 100 GB NVMe
ADVANCED · vn-03Recommended

VPS-4T

548.900 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478