Welcome! Log In Create A New Profile

Advanced

Re: Vhost support

January 29, 2011 01:18PM
On Sat, Jan 29, 2011 at 10:37:02PM +1000, Mark Constable wrote:

> On 29/01/11, António P. P. Almeida wrote:
> > Make it:
> > server_name ~^(?<p1>[^\.]*)[\.]*(?<p2>[^\.]*)[\.]*(?<p3>[^\.]*)[\.]*(?<p4>[^\.]+)\.(?<p5>[^\.]+)$;
> > Forgot to escape the "." in the named capturing groups.
>
> Thanks Antonio, this does indeed work. The only downside I can see is
> that the system file path is something like /var/www////com/domain/,
> when there are less than 5 parts, but it still seems to work okay.
>
> server {
> listen 80;
> server_name ~^(?<p1>[^\.]*)[\.]*(?<p2>[^\.]*)[\.]*(?<p3>[^\.]*)[\.]*(?<p4>[^\.]*)[\.]*(?<p5>[^\.]*)$;
>
> location / {
> root /var/www/$p5/$p4/$p3/$p2/$p1;
> index index.html index.htm index.jsx index.php;
> }
> }

You just need to set several servers with different regexes.


--
Igor Sysoev
http://sysoev.ru/en/

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

Vhost support

Mark Constable January 29, 2011 02:08AM

Re: Vhost support

Igor Sysoev January 29, 2011 02:10AM

Re: Vhost support

Mark Constable January 29, 2011 02:38AM

Re: Vhost support

Igor Sysoev January 29, 2011 03:04AM

Re: Vhost support

António P. P. Almeida January 29, 2011 03:06AM

Re: Vhost support

António P. P. Almeida January 29, 2011 03:46AM

Re: Vhost support

Mark Constable January 29, 2011 07:40AM

Re: Vhost support

Igor Sysoev January 29, 2011 01:18PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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