Welcome! Log In Create A New Profile

Advanced

Dynamic server name

Posted by Lime 
Dynamic server name
June 14, 2015 10:56AM
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!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 330
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready