How to Install Forgejo on Your Synology NAS

How to Install Forgejo on Your Synology NAS

Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job. Brought to you by an inclusive community under the umbrella of Codeberg e.V., a democratic non-profit organization, Forgejo can be trusted to be exclusively Free Software. It is a “soft” fork of Gitea with a focus on scaling, federation and privacy. In this step by step guide I will show you how to install Forgejo on your Synology NAS using Docker and Portainer.

💡Note: This guide works perfectly with the latest Forgejo v7.0.3 release.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.

  • STEP 3

Make sure you have a synology.me Wildcard Certificate. Follow my guide to get a Wildcard Certificate. If you already have a synology.me Wildcard certificate, skip this STEP.

  • STEP 4

Install Text Editor via Synology “Package Center”. (Mandatory STEP.) If you already have Text Editor installed on your Synology NAS, skip this STEP.

Synology Install Text Editor 2023

  • STEP 5

Go to Control Panel / Login Portal / Advanced Tab / click Reverse Proxy. Follow the instructions in the image below.

Forgejo Synology NAS Set up 1

  • STEP 6

Now click the “Create” button. Follow the instructions in the image below.

Forgejo Synology NAS Set up 2

  • STEP 7

After you click the Create button, the window below will open. Follow the instructions in the image below.

On the General area, set the Reverse Proxy Name description: type in Forgejo. After that, add the following instructions:

Source:
Protocol: HTTPS
Hostname: forgejo.yourname.synology.me
Port: 443

Check Enable HSTS

Destination:
Protocol: HTTP
Hostname: localhost
Port: 3053

Forgejo Synology NAS Set up 3

  • STEP 8

On the Reverse Proxy Rules click the Custom Header tab. Click Create and then, from the drop-down menu, click WebSocket. After you click on WebSocket, two Header Names and two Values will be automatically added. Click Save. Follow the instructions in the image below.

Synology Proxy WebSocket

  • STEP 9

Go to Control Panel / Network / Connectivity tab/ Check Enable HTTP/2 then click Apply. Follow the instructions in the image below.

Forgejo Synology NAS Set up 4

  • STEP 10

Go to Control Panel / Security / Advanced tab/ Check Enable HTTP Compression then click Apply. Follow the instructions in the image below.

Forgejo Synology NAS Set up 5

  • STEP 11

Go to File Station and open the docker folder. Inside the docker folder, create one new folder and name it forgejo. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Forgejo Synology NAS Set up 6

  • STEP 12

Now create two new folders inside the forgejo folder that you created at STEP 11 and name them data and db. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Forgejo Synology NAS Set up 7

  • STEP 13

Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.

1 Synology Portainer Add Stack

  • STEP 14

In the Name field type in forgejo. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

version: "3.9"
services:
  db:
    image: postgres:16
    container_name: Forgejo-DB
    hostname: forgejo-db
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD", "pg_isready", "-q", "-d", "forgejo", "-U", "forgejouser"]
      timeout: 45s
      interval: 10s
      retries: 10
    volumes:
      - /volume1/docker/forgejo/db:/var/lib/postgresql/data:rw
    environment:
      - POSTGRES_DB=forgejo
      - POSTGRES_USER=forgejouser
      - POSTGRES_PASSWORD=forgejopass
    restart: on-failure:5

  web:
    image: codeberg.org/forgejo/forgejo:1.21
    container_name: Forgejo
    hostname: forgejo
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:3000
    ports:
      - 3053:3000
      - 2222:22
    volumes:
      - /volume1/docker/forgejo/data:/data:rw
      - /etc/TZ:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - USER_UID=1026
      - USER_GID=100
      - GITEA__database__DB_TYPE=postgres
      - GITEA__database__HOST=forgejo-db:5432
      - GITEA__database__NAME=forgejo
      - GITEA__database__USER=forgejouser
      - GITEA__database__PASSWD=forgejopass
      - ROOT_URL=https://forgejo.yourname.synology.me
    restart: on-failure:5

Note: Before you paste the code above in the Web editor area below, change the value numbers for USER_UID and USER_GID with your own values. (Follow my step by step guide on how to do this.) 1026 is my personal USER_UID value and 100 is my personal USER_GID value. You have to type in your own values.
Note: Before you paste the code above in the Web editor area below, change the value for ROOT_URL and type in your own synology.me DDNS with https:// at the beginning that you have previously created at STEP 7.

Forgejo-Synology-NAS-Set-up-8-new-2025

  • STEP 15

Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

Forgejo-Synology-NAS-Set-up-9-new-2025

  • STEP 16

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

Forgejo Synology NAS Set up 10

  • STEP 17

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 18

Now open your browser and type in your HTTPS/SSL certificate like this https://forgejo.yourname.synology.me In my case it’s https://forgejo.mariushosting.synology.me If everything goes right, you will see the Forgejo configuration page. Type in your Company Name then scroll down on the page. Follow the instructions in the image below.

Forgejo Synology NAS Set up 11

  • STEP 19

On the Server Domain field type in your own synology.me DDNS that you have previously created at STEP 7 without https at the beginning. On the SSH Server Port type in 2222 instead of 22. On the Forgejo Base URL field type in your own synology.me DDNS that you have previously created at STEP 7 with https at the beginning. Click Email Settings. Follow the instructions in the image below.

Forgejo Synology NAS Set up 12

  • STEP 20

Follow my step by step guide on how to activate SMTP for your Gmail account. This step is mandatory. Note: If you don’t want to use the easiest way for SMTP with Google and you already have SMTP details from your own Mail Server, you can just skip this STEP and use your personalized email SMTP details instead.

  • STEP 21

Add your own SMTP details. Follow the instructions in the image below.

SMTP Host: smtp.gmail.com
SMTP Port: 465
Send Email As: Type in your own Gmail address.
SMTP Username: Type in your own Gmail address.
SMTP Password: Type in your own Gmail App Password / STEP 20.

Select Require Email confirmation to register then click Enable Email Notifications. Click Install Forgejo.

Forgejo Synology NAS Set up 13

  • STEP 22

After you click Install Forgejo at STEP 21, you will get a Synology blank page error message because the installation is not finished. Remove /user/login at the end of your synology.me DDNS address then refresh the page. Follow the instructions in the image below.

Forgejo Synology NAS Set up 14

  • STEP 23

At the top right of the page click Register. Follow the instructions in the image below.

Forgejo Synology NAS Set up 15

  • STEP 24

Type in your own Username, Email Address and Password. Confirm the Password then click Register Account. Follow the instructions in the image below.

Forgejo Synology NAS Set up 16

  • STEP 25

At the top right of the page click Settings. In this area you can change different parameters for your Forgejo installation. For example, you can switch the theme to Dark Mode. Select forgejo-dark then Update Theme. Follow the instructions in the image below.

Forgejo Synology NAS Set up 17

  • STEP 26

If you want to modify some settings in Forgejo, for example disable user registration, continue to follow the instructions. Make sure you have installed Synology Text Editor as per the instructions at STEP 4. In File Station go to docker / forgejo / data / gitea / conf and double click on the app.ini file. Scroll down until you find DISABLE_REGISTRATION and type in true instead of false. Click X to save the file. Follow the instructions in the image below.

Forgejo Synology NAS Set up 18

  • STEP 27

To apply the settings, you have to restart the Forgejo container. On the left sidebar in Portainer, click Containers. Identify your Forgejo instance, select it then click Restart. Follow the instructions in the image below.

Forgejo Synology NAS Set up 19

Enjoy Forgejo!

🆘TROUBLESHOOTING

If you encounter issues by using this container, make sure to check out the Common Docker issues article.

Note: Can I run Docker on my Synology NAS? See the supported models.
Note: How to Back Up Docker Containers on your Synology NAS.
Note: Find out how to update the Forgejo container with the latest image.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: Instead of the synology.me DDNS you can also use your own domain name.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.
Note: Find out the Best NAS Models For Docker.
Note: Activate Gmail SMTP For Docker Containers.