Documenting the steps I took to set up a custom domain that points to a Raspberry Pi server.


  • You have a Raspberry Pi that’s accessible via other devices on the network
  • You own a domain that you can use to point to the Raspberry Pi server e.g

Static IP

Setting up a static IP makes things a bit easier. Follow a guide. You basically have to add the following lines to /etc/dhcpcd.conf. This is just an example

interface eth0
static ip_address=
static routers=
static domain_name_servers=

where eth0 is the network interface, ip_address is the static IP address we want the device to have, routers is the gateway IP address and the domain_name_servers is the DNS server which is usually just the router’s address.

NGINX Server

We’ll use NGINX as the web server. Install and run NGINX via

sudo apt install nginx
systemctl start nginx

Go to https://<static_ip_address> and you should see the NGINX test page.

DNS configuration

First we need a DNS configuration that will forward all * requests to the Raspberry Pi’s current IP address.

Using Google Domains, go to DNS->Synthetic records and create a new Dynamic DNS record for *

DEPRECATED I use ddclient instead.

Download this script and fill in credentials/hostname and run the script. The script basically grabs the IP address and updates the DNS in Google Domains so the domain points to the IP address.



# Resolve current public IP
IP=$( dig +short )
# Update Google DNS Record
curl -s $URL

Port Forward

You’ll need to forward ports 80 and 443 to the Raspberry Pi device. The instructions depend on the router you’re using.

Test Domain

You should be able to go to and see the NGINX test page.