Page 1 of 1

Serving one website under multiple domains with Piku

Posted: Mon Jul 13, 2026 11:49 am
by vildravn
Since Piku by default uses nginx, it's actually super simple to serve the same website under multiple domains. A common usecase for that is serving the same website under example.com and www.example.com. There's only one small gotcha with Let's Encrypt certificates.

The NGINX_SERVER_NAME env var in the ENV file is actually a space separated list, piku's scripts split the list up and handle everything for multiple domains, so all you need to do is list all of them in like so:

Code: Select all

NGINX_SERVER_NAME=example.com www.example.com
Let's Encrypt even supports a certificate generated for multiple domains, the only catch is that piku doesn't handle it very well if you have a site already up and add a new domain. It'll just look at the first domain, see that the cert already exists and is valid and skips generating a new one that's valid for both/more domains. The workaround there is to put the new domain in the ENV file var first. For example, if this was your original ENV file

Code: Select all

NGINX_SERVER_NAME=example.com
Put the new domain first, not last

Code: Select all

NGINX_SERVER_NAME=www.example.com example.com
That will make piku generate a new certificate that is actually valid for both domains.