Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

Forgejo Behind Traefik: A Docker Compose Setup Guide

Run Forgejo behind Traefik by proxying its web interface on port 3000, persisting /data, setting the public HTTPS ROOT_URL, and configuring SSH access as a separate path.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run Forgejo behind Traefik, route its web interface to the container’s port 3000 and set Forgejo’s ROOT_URL to its public HTTPS address. Handle Git-over-SSH separately: Traefik’s HTTP routing does not automatically forward SSH. Persist Forgejo’s /data directory, keep the web port private behind the proxy, and adapt network, domain, entrypoint, and certificate-resolver settings to your existing Traefik configuration.

How Forgejo and Traefik fit together

Forgejo serves its web interface inside the container on port 3000 in the official Docker example. Traefik’s Docker provider reads labels from the Forgejo Compose service and creates an HTTP router that sends requests for your chosen hostname to that backend port. TLS is configured on Traefik’s router using the entrypoint and certificate resolver already defined in your Traefik installation.

As an Amazon Associate I earn from qualifying purchases.

Git-over-SSH follows a separate path. The official Forgejo Docker example maps container port 22 to host port 222. You can use another host port, but SSH clients must be able to reach it and the port advertised in Forgejo’s clone URLs must match. The HTTP router for your website does not, by itself, expose or proxy SSH.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a network and public address

Connect Traefik to Forgejo

Traefik must share a Docker network with Forgejo so it can reach the container. You can use a network shared by other proxied services or create a dedicated network for the proxy and Forgejo. If Forgejo is attached to multiple networks, tell Traefik which one to use with the traefik.docker.network label, or configure the Docker provider’s default network. The chosen network must be reachable by Traefik.

#1 Best Overall
HP EliteDesk 800 G2 Desktop Mini Business PC, Intel Quad-Core i5-6500T up to 3.1G, 16GB DDR4, 240GB SSD, VGA, DP, Win 11 Pro 64 bit (Renewed)
  • This Certified Refurbished product is tested and certified to look and work like new. The refurbishing process includes functionality testing, basic cleaning, inspection, and repackaging. The product ships with all relevant accessories, a minimum 90-day warranty, and may arrive in a generic box. Only select sellers who maintain a high performance bar may offer Certified Refurbished products on Amazon.com
  • Intel Quad-core i5-6500T up to 3.1G,16G DDR4 memory(2 slots,supports up to 32GB),240G SSD
  • Includes USB Keyboard(English Keyboard & Mouse Included)
  • I/O ports:Front:2 USB 3.0 ,microphone,headphone ,USB Type-C port Rear:4USB 3.0 ,VGA DP port,RJ-45
  • Operating System:Win10Pro64bit

Traefik can usually detect a container’s backend port, but specify it explicitly when port detection is unsuitable or the container exposes multiple ports. For Forgejo’s web interface, the backend is port 3000.

Prefer a dedicated hostname

A dedicated hostname, such as git.example.com, is the straightforward choice. Forgejo’s reverse-proxy guidance explains that hosting under a subpath changes browser same-origin assumptions and may introduce risks when user-controlled content is served on the same origin. Use a subpath only when it is a deliberate requirement and you have accounted for those implications.

Rank #2
Beelink SER3 Mini PC AMD Ryzen 3 3200U (up to 3.5GHz), 8GB DDR4 480GB PCIE3.0 SSD Mini Computer, Radeon Vega 3 Graphics,1000Mbps LAN, Dual HDMI 4K Display Home-Office PC
  • 【SER3 Next-Gen Light Office Mini PC】Beelink Mini pc New SER3 AMD Ryzen 3 3200U Processor (2.6-3.5GHz 2C/4T),with Radeon Vega 3 Graphics 3core 1200 MHz, Light office, 4K multimedia playback, virtual machine, NAS, meeting all your daily needs, Beelink mini pc is only 4.88 x 4.44 x 1.65 inches and takes up only 1/40
  • 【8GB DDR4 RAM+ 480GB PCIe3.0 SSD】SER3 Beelink mini pc comes with 8GB SODIMM DDR4 memory, dual-channel memory expansion slots supports up to 32GB (2x16GB) expansion, you can also replace the 480GB SSD up to 2TB (excluded) M.2 PCIE3.0 x4(2280) slot (Incompatible with SATA3 SSDs), or add a 2.5inch 7mm HDD(max 2TB, excluded) to expand the storage. Large capacity brings quicker load times across your entire catalogue of apps and programs
  • 【USB3.2 + WiFi 5 + BT 5.0】Beelink AMD Ryzen 3 3200U Mini Desktop Computer is equipped with rich interfaces: USB3.2x4, HDMI x2, 1000M LANx1. The transmission rate of USB3.2 is up to 10Gbps, 21 times faster than USB2.0. WiFi 5 (802.11ac) Bluetooth5.0 lower latency , more stable and efficient to connect to multiple wireless devices such as projector, printer, monitor, speakers and etc
  • 【Improve Work Efficiency】SER3 Dual HDMI prots allow you to expand your viewing area to enjoy better experience and multi-task easily, i.e. web browsing, design, 4K videos playback, online class, perfectly valid as a multimedia center to use KODI, IPTV or use as a digital signage and brings true-to-life 4K@60Hz visual feat to the audiance
  • 【Why Beelink Mini PC】Beelink SER3 VESA mount can hide the micro pc behind a monitor or HDTV like an all-in-one pc, free you from messy desktop, Cooling system Large fan and dual heat conduction tube,make heat dissipation more efficient,3200U Mini desktop pc also supports Wake On LAN, RTC Wake, Auto Power On, a great to use as a server for media (Plex or FTP)

Configure Forgejo’s web address and persistent data

Set Forgejo’s public ROOT_URL to the HTTPS URL users will visit, for example https://git.example.com/. This lets Forgejo generate links that point to the public address rather than an internal container URL. Forgejo can provide HTTPS without a reverse proxy, but proxying HTTPS through Traefik is a documented, common arrangement.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The official Docker deployment stores application state under /data. Persist that directory with a host-mounted volume or another suitable persistent Docker storage arrangement so the state survives container replacement. In the official example, UID and GID environment values control the container’s user; the host directory must have compatible ownership or the container may fail to start. A mounted directory keeps data persistent, but is not by itself a tested backup.

Rank #3
HP EliteDesk 800 G4 Mini Tiny Business PC, Intel Hexa-Core i5-8500T up to 3.5GHz, 16GB DDR4 RAM, 256GB NVMe SSD, Dual Monitor Support, WiFi, Bluetooth, HDMI, DisplayPort, Windows 11 64-bit (Renewed)
  • Powerful Performance: Intel Core i5 Hexa Core processor for reliable multitasking and smooth computing.
  • Fast & Efficient: 16GB DDR4 RAM and 250GB SSD for quick startup and performance.
  • Windows 11 Pro: Modern operating system with professional-grade tools and enhanced security.
  • Compact Design: Space-saving mini chassis fits neatly on or under your desk.
  • Renewed Quality: Professionally tested and renewed to perform like new; may show minor cosmetic wear.

The following is a configuration shape, not a complete drop-in file. Replace the example hostname, network, entrypoint, and certificate-resolver names with values that exist in your environment. Adapt the image version and UID/GID to your deployment, and review the labels against the Forgejo and Traefik versions you run.

services:
  forgejo:
    image: codeberg.org/forgejo/forgejo:VERSION
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - FORGEJO__server__ROOT_URL=https://git.example.com/
    volumes:
      - ./forgejo-data:/data
    networks:
      - traefik
    labels:
      - traefik.enable=true
      - traefik.docker.network=traefik
      - traefik.http.routers.forgejo.rule=Host(`git.example.com`)
      - traefik.http.routers.forgejo.entrypoints=websecure
      - traefik.http.routers.forgejo.tls=true
      - traefik.http.routers.forgejo.tls.certresolver=YOUR_RESOLVER
      - traefik.http.services.forgejo.loadbalancer.server.port=3000

networks:
  traefik:
    external: true

This example deliberately does not publish Forgejo’s web port on the host. It also does not publish SSH: choose an SSH exposure method separately, such as a host port mapping that is restricted and reachable as intended. If you publish the web port as well as routing through Traefik, restrict direct access so untrusted clients cannot bypass the proxy.

Make Git-over-SSH reachable

For SSH cloning, clients connect to the host and port you expose for Forgejo’s container port 22. The official Docker example uses a host mapping of port 222 to container port 22. If you choose a different host port, ensure Forgejo advertises that port in its SSH clone URLs and users’ SSH commands use the same port. If you use the standard SSH port instead, account for any existing SSH service on the host.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Alternatively, expose SSH through a separate TCP-capable routing arrangement if your infrastructure supports it. Either way, define and test this path independently from the HTTPS web router; a successful web login does not establish that SSH cloning will work.

Best Value
Beelink Me Pro, Mini PC NAS, Intel N150 CPU, 16GB LPDDR5, 1TB SSD, 3*M.2 PCIe3.0 SSD Slots + 2*HDD Bays(MAX 72TB), 5G + 2.5G Dual LAN/WiFi6/BT5.4, 4K Media Library, Private Cloud, Soft Router
  • 【Hybrid 2-Bay Storage: NAS & Mini PC in One】Beelink ME Pro features two 3.5"/2.5" SATA HDD slots and three M.2 PCIe3.0 SSD slots (pre-installed with a 1TB system drive) supporting a massive 72TB expansion. it’s the ultimate solution for building a massive private cloud, automated backups, or a centralized media library
  • 【Next-Gen Intel N150 & 16GB LPDDR5】 Powered by the Intel N150 processor (up to 3.6GHz, max 25W TDP) and 16GB LPDDR5 4800MT/s RAM, this mini pc delivers efficient multitasking and smooth performance for home office, virtualization, and server tasks with lower power consumption
  • 【5GbE + 2.5GbE High-Speed Dual Networking】 Equipped with 5G & 2.5G Ethernet ports, this Dual LAN Mini PC supports network aggregation and high-speed data transfer. Ideal for stable, lag-free access to your files, high-speed downloading, and advanced networking configurations like soft routing
  • 【Swappable Modular Motherboard】The innovative DlY drawer-style design supports easy motherboard upgrades, compatible with Intel N-series, Intel 12th/13th/14th/15th Gen, AMD FP8 series, and ARM architectures
  • 【Easy Dust Cleaning】Simply slide out the motherboard for quick maintenance
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Secure the proxy boundary

Keep the web listener private

When Traefik is intended to be the public ingress, leave Forgejo’s web port reachable only from the proxy network, or use host firewall rules to restrict it. This is particularly important for Forgejo v15: its v15 Docker documentation says security.REVERSE_PROXY_TRUSTED_PROXIES defaults to * and warns against making the web port directly accessible from untrusted networks. The same page says the default changed in v16.0.0, while the v15 LTS line retained the prior behavior as a breaking change. Check the actual setting for the version and release line you deploy rather than applying the v15 warning to all versions.

Trust only the proxy addresses

Forgejo’s current reverse-proxy documentation lists loopback addresses as the default trusted-proxy ranges and explains how to limit trusted ranges and proxy depth. Configure trusted proxies to match the addresses or network from which Traefik connects. Do not trust forwarded headers from arbitrary clients: those headers are only meaningful when they arrive through a proxy you trust.

Forgejo also offers reverse-proxy authentication as an optional feature, not a requirement for ordinary proxying. Its documentation notes that this feature does not support the API; API access still requires token or basic authentication.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a release and plan upgrades

Forgejo documents a stable release every three months and an LTS release every year. Choose the release line that suits your maintenance needs, then check its release notes before upgrading. Forgejo says moving from one major version to the next requires a manual operation and human verification, so do not treat a major-version image change as a routine unattended update. Make a backup before upgrading and verify that you can restore it; the Docker volume example alone does not specify a complete backup-and-restore procedure.

Check the deployment before opening access

  • Confirm Traefik and Forgejo share the intended Docker network, and explicitly select it if Forgejo is attached to more than one.
  • Check that the router’s hostname, entrypoint, TLS settings, and certificate resolver match your Traefik configuration, and that its backend port is 3000.
  • Visit the public HTTPS URL and confirm generated links use the same address.
  • Check that the Forgejo web port is not reachable from untrusted networks outside the intended proxy path.
  • Test SSH cloning separately, using the exposed host and port that Forgejo advertises.
  • Verify the trusted-proxy setting for your deployed Forgejo version and limit it to Traefik’s actual source addresses or network.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.