Linux
- Systemd
- init.d (Debian/Ubuntu)
- init.d (CentOS/RHEL)
- OpenRC (Gentoo)
Systemd is the default init system on most modern Linux distributions (Ubuntu 16.04+, Debian 8+, CentOS 7+, Fedora, Arch Linux, etc.).Gogs ships with a systemd service template at Here is the default service file for reference:Update the following values to match your environment:
scripts/systemd/gogs.service in the installation directory.1. Customize the service file
Copy the template and edit it to match your installation:UserandGroup— the system user running GogsWorkingDirectory— the Gogs installation directoryExecStart— the full path to the Gogs binaryEnvironment— ensureUSERandHOMEmatch the Gogs user
2. Enable and start the service
3. Verify the service
If you have repositories with a large number of files and encounter HTTP 500 errors, uncomment the
LimitMEMLOCK=infinity and LimitNOFILE=65535 directives in the service file.Windows
On Windows, Gogs can run as a native Windows service using either the builtinminwinsvc support or the third-party NSSM tool.
- Builtin (sc.exe)
- NSSM
Gogs binaries built with the Replace Start the service:You should see:
minwinsvc tag (release archive name that contains mws) support running as a native Windows service.1. Configure Gogs for Windows
EditC:\gogs\custom\conf\app.ini:COMPUTERNAME with the output of echo %COMPUTERNAME% in a command prompt. For example, if the computer name is USER-PC, set RUN_USER = USER-PC$.Configure the server section:2. Add a hosts entry
Open Notepad as Administrator and editC:\Windows\System32\drivers\etc\hosts: