Regex on Variable ($servername)

basti mailinglist at unix-solution.de
Sun Oct 29 10:53:23 UTC 2017


Hello,

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: www.example.com -> $domain should be example.com

Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20171029/115c3ef4/attachment.html>


More information about the nginx mailing list