dynamic server name and aliases

spyfox nginx-forum at forum.nginx.org
Fri Feb 19 07:22:35 UTC 2016

Hi everybody,
I manage server, where each user has own subdomain:
i1.domain -> user #1
i2.domain -> user #2

I have a nginx config to handle user's subdomains:

server {
	listen *:80;
	server_name ~^i(?<instanceId>\d+)\.domain$;

It works fine. I have single config to handle all requests for all

I need to allow users specify custom domains as aliases, e.g.:

i1.domain, super-user.com, another-domain.net -> user #1
i2.domain, custom.domain -> user #2

How can I add aliases without copy/paste config for each user?

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,264612,264612#msg-264612

More information about the nginx mailing list