Welcome! Log In Create A New Profile

Advanced

Re: 'auto'rewrite link to a folder

Francis Daly
August 14, 2014 05:02AM
On Thu, Aug 14, 2014 at 09:12:39AM +0200, Pascale Camille wrote:

Hi there,

> i confirmed it used to work greatly
> i was working as teacher and needed subdomain easy
> create or delete in one minute!
> avoiding me to do subdomain process...
> (no database site)

I don't see how what you provided could ever have worked as you describe.

However, that does not matter: the following skeleton seems to work for
me; add the rest of your config in as needed:

Preparation:

$ mkdir -p /tmp/www/{one,two,three}
$ for i in /tmp/www/{one,two,three}; do
echo "content of $i/index.html" > $i/index.html; done

nginx.conf server block:

server {
server_name ~^(?P<user>.+).example.com;
root /tmp/www/$user;
}

Note that I use the "(?P<" syntax for the named capture; that's what my
pcre engine needs.

Then test:

$ curl -H Host:one.example.com http://localhost/
content of /tmp/www/one/index.html
$ curl -H Host:two.example.com http://localhost/
content of /tmp/www/two/index.html
$ curl -H Host:nil.example.com http://localhost/

which gives "404 Not Found", as expected.

f
--
Francis Daly francis@daoine.org

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

'auto'rewrite link to a folder

Pascale Camille August 13, 2014 04:44PM

Re: 'auto'rewrite link to a folder

Francis Daly August 13, 2014 07:46PM

Re: 'auto'rewrite link to a folder

Pascale Camille August 14, 2014 03:14AM

Re: 'auto'rewrite link to a folder

Francis Daly August 14, 2014 05:02AM

full main.conf

Pascale Camille August 14, 2014 03:36AM

Re: 'auto'rewrite link to a folder

Pascale Camille August 14, 2014 10:34AM

Re: 'auto'rewrite link to a folder

Francis Daly August 14, 2014 01:24PM

Re: 'auto'rewrite link to a folder

bodomic August 14, 2014 10:47AM

Re: 'auto'rewrite link to a folder

Pascale Camille August 14, 2014 10:52AM

Re: 'auto'rewrite link to a folder

Pascale Camille August 14, 2014 11:56AM

Re: 'auto'rewrite link to a folder

Pascale Camille August 14, 2014 02:28PM

Re: 'auto'rewrite link to a folder

bodomic August 15, 2014 03:22AM

Re: [resolved]'auto'rewrite link to a folder

Pascale Camille August 15, 2014 11:46AM

Re: [resolved]'auto'rewrite link to a folder

Pascale Camille August 19, 2014 07:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 168
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready