Setup Gitea server on OpenBSD

This guide will help you set up a Gitea server on OpenBSD

This guide will help you set up a Gitea server on OpenBSD 6.3 with PostgreSQL and using the built in OpenBSD httpd server. The following guide is still applicable to OpenBSD 6.4 without modification.

Gitea is a a painless self-hosted Git service. Gitea is a community managed fork of Gogs, lightweight code hosting solution written in Go and published under the MIT license. It is also made with the intention of being easy to install, making it a great solution overall for a small-medium scale Git service.

  1. Install the necessary packages
pkg_add -z go gitea postgresql-server postgresql-client
  1. Edit /etc/rc.conf.local
pkg_scripts=postgresql gitdaemon gitea
  1. Start the services
rcctl gitdaemon start
rcctl gitea start
  1. Create the database
mkdir /var/postgresql/data
initdb -D /var/postgresql/data -U postgres -E UTF8 -A md5 -W
pg_ctl -D /var/postgresql/data start
createuser -U postgres --pwprompt --no-superuser --createdb --no-createrole gitea
createdb -U gitea gitea
  1. Create the self-signed keys. Replace the IP with the IP address of your own server. The purpose of this is so that relayd automatically detects and begins using them.
openssl genrsa -out /etc/ssl/private/
openssl req -new -x509 -key /etc/ssl/private/ -out /etc/ssl/ -days 3365
  1. Configure /etc/relayd.conf. Note replace host value URL with your own as well as the listen on IP address.
table <gitea> { }

http protocol "httpproxy" {

pass request quick header "Host" value "" \
	forward to <gitea>


relay "proxy" {
	listen on port 443 tls 
	protocol "httpproxy"

	forward to <gitea> port 3000 
  1. Start httpd
rcctl start relayd
  1. Make required directory for Gitea
mkdir -p /usr/local/share/gitea/data/lfs
  1. Access Gitea at the below URL and go through the installation

https://ip address>

  1. After the installation edit /etc/gitea/conf/app.ini as following
PROTOCOL               = http
DOMAIN                 =
ROOT_URL               =
HTTP_ADDR              =
HTTP_PORT              = 3000
LOCAL_ROOT_URL         =
SSH_DOMAIN             =
  1. Restart Gitea due to the app.ini changes
rcctl restart gitea

You should now be able to access your Gita instance at


Load Comments?