Betula website

Setting up a domain and HTTPS

For full internet Betula experience, you will need to set up a domain and, preferably, HTTPS. If you are just using Betula locally, do not bother, unless you want to.

Setting up a domain

Domains cost money. Pick a good registrar and buy your domain. It doesn't really matter which one you buy, they work basically the same. Some good registrars are Gandi, Dynadot, Beget (recommended for Russian users). Avoid GoDaddy, it has a very poor user experience and customer support.

Usually, Betula is served with a subdomain. For example, if you have bought example.com, http://example.com should lead to your personal site, and http://links.example.com should lead to your Betula. links. subdomains are recommended, most betulists use them, some use betula. though. You can serve Betula on a top-level domain too, of course.

In your domain registrar control panel, find DNS management. DNS is the database used for domain name resolution. For your chosen domain, add a A record and write your server's IP as its value. Save. DNS might take a while to update.

Now, your Betula is available on http://yourdomain:port. It's not good enough.

Setting up HTTPS (and port redirection)

HTTPS is used for secure page loading in the Web. You should use it for security. Other Fediverse instances will ignore your server if it doesn't have HTTPS. Usually, HTTPS certificates cost money. Luckily, Let's Encrypt offers free certificates for everyone; we're going to use them.

Reverse proxy is a web application that forwards requests and modifies them in a specific manner. Betula relies on reverse proxies for domain and HTTPS support.

We provide guides for nginx and Caddy below. You can use any other reverse proxy, if you want.

nginx

Nginx is a popular web server application. It can be used as a reverse proxy. Your server might already have it installed.

After installing nginx, edit /etc/nginx/nginx.conf. In http section, create a new server section for your Betula:

# ...

http {
	# ...

	# Very recommended to have the next line, it makes loading faster for users.
	gzip on;

	server {
		# Change with your domain.
		server_name links.example.org;

		location / {
			# Change with your port, if you don't use 1738.
			proxy_pass http://127.0.0.1:1738;
			# Required for Fediverse.
			proxy_set_header Host $host;
		}
	}

	# ...
}

For HTTPS support, we recommend using certbot. It gives you free HTTPS certificates and updates nginx config for you.

Run Certbot. It sets up certificates and HTTPS to HTTP redirections. If you want to disable HTTPS to HTTP redirections, edit the nginx configuration file.

Caddy

Unlike other web servers, Caddy offers built-in HTTPS management.

Here's a Caddy configuration contributed by Klaus Alexander Seiļ¬†rup.

# Unsecure HTTP will automatically be redirected to HTTPS
betula.example.com {
  # Email address for use with the TLS certificate
  tls hello@example.com

  header {
    # 365 days in seconds
    Strict-Transport-Security "max-age=31536000"
  }

  log {
    output file /var/log/caddy/betula.example.com.log
    # Start a fresh log file every 16 MiB
    roll_size 16MiB
    # Keep last 16 log files
    roll_keep 16
  }

  route /* {
    # Just send everything to Betula
    reverse_proxy http://127.0.0.1:1738
  }

  # Offer on-the-fly compression
  encode zstd gzip
}

Finish

In your Betula settings, write down your domain. Doing so ensures RSS feeds, bookmarklet and federation work correctly. Now, you are ready for the internet.