← Back to blog

FROM THE BLOG

Connect a Frappe Site to a Production Subdomain

Point DNS at your server, assign the hostname to the Frappe site, refresh Nginx and finish with HTTPS.

Flat illustration of a subdomain route from a globe to a secure website

A subdomain such as app.example.com makes a Frappe site accessible under a memorable production URL. The setup has three parts: DNS must reach the server, Bench must know which site owns the hostname, and Nginx must serve that hostname.

1. Point DNS to the server

Create an A record for the subdomain with the public IPv4 address of your server. If you use IPv6, configure an AAAA record too. Wait until the hostname resolves correctly before requesting a certificate; DNS propagation may take time.

2. Assign the domain to the site

From your Bench directory, add the custom domain and select the existing site when prompted. Regenerate Nginx configuration, test it, and reload the service. The Frappe custom-domain guide documents this sequence.

cd ~/frappe-bench
bench setup add-domain app.example.com
bench setup nginx
sudo nginx -t
sudo service nginx reload

If your Bench is not already in production mode, configure it first with sudo bench setup production YOUR_LINUX_USER. When hosting multiple sites on one Bench, review the DNS multitenancy guide so requests reach the intended site.

3. Add HTTPS and verify

Once DNS and HTTP routing work, use Bench’s Let’s Encrypt setup for the site and its custom domain. The certificate command requires a valid public domain and a DNS multitenant setup. Check that https://app.example.com opens the correct site after configuration.

sudo -H bench setup lets-encrypt site1.example.com --custom-domain app.example.com

Replace both example hostnames with your real values. If verification fails, check DNS, firewall ports 80/443, the generated Nginx configuration and service logs before repeating the certificate request.

Based on: Abdo Host’s original article on Medium.