Welcome! Log In Create A New Profile

Advanced

Re: sub domain trickery

Maxim Dounin
January 03, 2011 05:50PM
Hello!

On Mon, Jan 03, 2011 at 07:00:12AM -0500, cjaredrun wrote:

> Not sure if this is possible, but I am wanting to make subdomains be
> redirected to specific folders dynamically via the nginx.conf file. so
> my DNS would point *.domain.com to the server. and depending on what the
> person typed in for the subdomain, for example folder1.domain.com it
> would point them to ~/public_html/folder1 for the site files.
> folder2.domain.com >> site files in ~/public_html/folder2.
>
> So if the folder exists, it goes there otherwise, goes 404.
>
> Is this possible to pull off dynamically?
>
> Thanks for thoughts on this.

Something like this should work:

server {
server_name ~^(?<domain>)\.example\.com$;
root /path/to/public_html/$domain;
}

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

sub domain trickery

cjaredrun January 03, 2011 07:00AM

Re: sub domain trickery

Maxim Dounin January 03, 2011 05:50PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 303
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