Welcome! Log In Create A New Profile

Advanced

Re: Having issues with nginx / root captures (0.7.53)

May 01, 2009 01:57AM
On Thu, Apr 30, 2009 at 03:51:04PM -0700, Michael Shadle wrote:

> i have this, which seemed like it would work according to my attempt
> just a week ago...
>
> server {
> listen 80;
> index index.php index.html;
> server_name ~^foo(.*?)\.bar\.ssgisp\.com$;
> root /home/mike/web/foo$1;
> include /etc/nginx/defaults.conf;
> include /etc/nginx/development.conf;
> include /etc/nginx/expires.conf;
> location ~ \.php$ {
> fastcgi_pass 127.0.0.1:11001;
> }
> }
>
> this is what the log shows in debug mode:
>
> 2009/04/30 14:43:25 [debug] 8702#0: *16 http script copy: "/home/mike/web/foo"
> 2009/04/30 14:43:25 [debug] 8702#0: *16 http script capture: "html"
> 2009/04/30 14:43:25 [debug] 8702#0: *16 http filename:
> "/home/mike/web/foohtml/index.html"
> 2009/04/30 14:43:25 [debug] 8702#0: *16 add cleanup: 0000000015092358
> 2009/04/30 14:43:25 [error] 8702#0: *16 open()
> "/home/mike/web/foohtml/index.html" failed (13: Permission denied),
> client: 134.134.139.71, server: ~^foo(.*?)\.mike\.bar\.com$, request:
> "GET /index.html HTTP/1.1", host: "foo2.mike.bar.com"
>
> non-debug:
>
>
> 2009/04/30 14:46:29 [crit] 8726#0: *17 stat()
> "/home/mike/web/foo/index.html" failed (13: Permission denied),
> client: 13.13.13.71, server: ~^foo(.*?)\.mike\.bar\.com$, request:
> "GET /index.html HTTP/1.1", host: "foo2.mike.bar.com"
> 2009/04/30 14:46:29 [error] 8726#0: *17 open()
> "/home/mike/web/foohtml/index.html" failed (13: Permission denied),
> client: 13.13.13.71, server: ~^foo(.*?)\.mike\.bar\.com$, request:
> "GET /index.html HTTP/1.1", host: "foo2.mike.bar.com"
>
> All I want is
>
> foo.mike.bar.com
> foo2.mike.bar.com
> foo-anything.mike.bar.com
>
> to map to /home/mike/web/foo, /home/mike/web/foo2,
> /home/mike/web/foo-anything, etc...
>
> Am I missing something here? and why is it capturing 'html' in the
> capture? I'm only creating a $1 from the server_name, is "html" a
> default somewhere?

First, "~^foo(.*?)\.bar\.ssgisp\.com$" will never match "foo2.mike.bar.com".
Second, "~^foo(.*?)\.bar\.com$" will capture "2.mike" with "foo2.mike.bar.com".

As to
2009/04/30 14:43:25 [debug] 8702#0: *16 http script capture: "html"

Probably somewhere in

include /etc/nginx/defaults.conf;
include /etc/nginx/development.conf;
include /etc/nginx/expires.conf;

this "html" is captured.

nginx configuration is declarative except ugly if/rewrite.
And these if/rewrite will run before the root variable substitution even
if root is described before if/rewrite:

root /home/mike/web/foo$1;
if (...)


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

Having issues with nginx / root captures (0.7.53)

mike April 30, 2009 06:51PM

Re: Having issues with nginx / root captures (0.7.53)

Igor Sysoev May 01, 2009 01:57AM

Re: Having issues with nginx / root captures (0.7.53)

mike May 01, 2009 02:16AM

Re: Having issues with nginx / root captures (0.7.53)

mike May 01, 2009 02:49AM

Re: Having issues with nginx / root captures (0.7.53)

Igor Sysoev May 01, 2009 02:41AM

Re: Having issues with nginx / root captures (0.7.53)

mike May 01, 2009 02:26AM

Re: Having issues with nginx / root captures (0.7.53)

Igor Sysoev May 01, 2009 02:38AM

Re: Having issues with nginx / root captures (0.7.53)

mike May 01, 2009 02:53AM

Re: Having issues with nginx / root captures (0.7.53)

Igor Sysoev May 01, 2009 02:54AM

Re: Having issues with nginx / root captures (0.7.53)

Igor Sysoev May 01, 2009 03:15AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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