Regex on Variable ($servername)

basti mailinglist at
Sun Oct 29 10:53:23 UTC 2017


i try to setup a catch all proxy server with nginx.
I want to catch domains like this but have only domainname (without
subdomain) in $domain

In this example from nginx docs domain has "fullname".

server {
    server_name ~^(www\.)?(*?<domain>*.+)$;
    root /sites/*$domain*;

servername: -> $domain should be

Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list