Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Dynamic server name

$
0
0
Hello!
My Nginx config currently looks like this:
server {
listen 80;
server_name ~^(www\.)?(?<domain>.+?).abc$;
root /usr/share/nginx/$domain;
index index.html index.htm;
}

It works like it should, when I visit http://example.abc it sets the root to the example directory. What I want though is for it to work with any top-domain instead of just .abc.
I have tried "server_name ~^(www\.)?(?<domain>.+)$;" from http://nginx.org/en/docs/http/server_names.html but all it does is return a 404 on every request.

Any help is appreciated!

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>