Why doesn't this work?

server {
listen 80;
index index.php index.html;
server_name ~^(.*?).mike.foo.com$;
set $name $1;
root /home/mike/web/$name;
location / { }
include /etc/nginx/defaults.conf;
include /etc/nginx/confs/development.conf;
include /etc/nginx/expires.conf;
location ~ .php$ {
include /etc/nginx/fastcgi.conf;
fastcgi_pass 127.0.0.1:11001;
}
try_files $uri $uri/ /controller.php?uri=$uri&$args;
}

SCRIPT_FILENAME is being passed /home/mike/web//index.php

document root is apparently not being filled in properly. in
fastcgi.conf:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

works great but in these captures it doesn’t seem to work 100%?

it even opens /home/mike/web/misc/index.php for a test in the
beginning…

this is nginx 0.7.59 (haven’t updated yet but i don’t think anything
should be different)

2009/06/24 15:59:19 [debug] 9862#0: *11 read: 18, 00007FFF4554C340,
2048, 0
2009/06/24 15:59:19 [debug] 9862#0: *11 rc: 0 user: “dev” salt:
“gdFfiPgTXkDlU”
2009/06/24 15:59:19 [debug] 9862#0: *11 post access phase: 10
2009/06/24 15:59:19 [debug] 9862#0: *11 try files phase: 11
2009/06/24 15:59:19 [debug] 9862#0: *11 content phase: 12
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy:
“/home/mike/web/”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “misc”
2009/06/24 15:59:19 [debug] 9862#0: *11 open index
“/home/mike/web/misc/index.php”
2009/06/24 15:59:19 [debug] 9862#0: *11 internal redirect: “/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 generic phase: 1
2009/06/24 15:59:19 [debug] 9862#0: *11 http script complex value
2009/06/24 15:59:19 [debug] 9862#0: *11 http script capture: “”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script set $name
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET
CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM
8)”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script regex:
“googlebot|looksmart|crawl|robot|findlinks|infoseek|search”
2009/06/24 15:59:19 [notice] 9862#0: 11
“googlebot|looksmart|crawl|robot|findlinks|infoseek|search” does not
match “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR
3.5.30729; MS-RTC LM 8)”, client: 173.50.224.172, server:
~^(.
?).mike.foo.com$, request: “GET / HTTP/1.1”, host:
misc.mike.foo.com
2009/06/24 15:59:19 [debug] 9862#0: *11 http script if
2009/06/24 15:59:19 [debug] 9862#0: *11 http script if: false
2009/06/24 15:59:19 [debug] 9862#0: *11 test location: “/”
2009/06/24 15:59:19 [debug] 9862#0: *11 test location: “robots.txt”
2009/06/24 15:59:19 [debug] 9862#0: *11 test location: “favicon.ico”
2009/06/24 15:59:19 [debug] 9862#0: *11 test location: ~ “/.ht”
2009/06/24 15:59:19 [debug] 9862#0: *11 test location: ~
“.(jpg|jpeg|gif|css|png|js|ico|html)$”
2009/06/24 15:59:19 [debug] 9862#0: *11 test location: ~ “.php$”
2009/06/24 15:59:19 [debug] 9862#0: *11 using configuration “.php$”
2009/06/24 15:59:19 [debug] 9862#0: *11 http cl:-1 max:263192576
2009/06/24 15:59:19 [debug] 9862#0: *11 generic phase: 3
2009/06/24 15:59:19 [debug] 9862#0: *11 post rewrite phase: 4
2009/06/24 15:59:19 [debug] 9862#0: *11 generic phase: 5
2009/06/24 15:59:19 [debug] 9862#0: *11 add cleanup: 0000000000F93858
2009/06/24 15:59:19 [debug] 9862#0: *11 generic phase: 6
2009/06/24 15:59:19 [debug] 9862#0: *11 generic phase: 7
2009/06/24 15:59:19 [debug] 9862#0: *11 access phase: 8
2009/06/24 15:59:19 [debug] 9862#0: *11 access phase: 9
2009/06/24 15:59:19 [debug] 9862#0: *11 read: 18, 00007FFF4554C110,
2048, 0
2009/06/24 15:59:19 [debug] 9862#0: *11 rc: 0 user: “development”
salt: “gdFkDlU”
2009/06/24 15:59:19 [debug] 9862#0: *11 post access phase: 10
2009/06/24 15:59:19 [debug] 9862#0: *11 try files phase: 11
2009/06/24 15:59:19 [debug] 9862#0: *11 malloc: 000000000146EE30:4096
2009/06/24 15:59:19 [debug] 9862#0: *11 http init upstream, client
timer: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 epoll add event: fd:17 op:3
ev:80000005
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy:
“/home/mike/web/”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy: “QUERY_STRING”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: "QUERY_STRING: "
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy:
“REQUEST_METHOD”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “GET”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: “REQUEST_METHOD:
GET”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy: “CONTENT_TYPE”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: "CONTENT_TYPE: "
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy:
“CONTENT_LENGTH”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: "CONTENT_LENGTH:
"
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy:
“SCRIPT_FILENAME”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var:
“/home/mike/web/”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “/index.php”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param:
“SCRIPT_FILENAME: /home/mike/web//index.php”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy: “SCRIPT_NAME”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “/index.php”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: “SCRIPT_NAME:
/index.php”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy: “REQUEST_URI”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “/”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: “REQUEST_URI: /”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy: “DOCUMENT_URI”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “/index.php”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: “DOCUMENT_URI:
/index.php”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy:
“DOCUMENT_ROOT”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var:
“/home/mike/web/”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: “DOCUMENT_ROOT:
/home/mike/web/”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy:
“SERVER_PROTOCOL”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “HTTP/1.1”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param:
“SERVER_PROTOCOL: HTTP/1.1”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy:
“GATEWAY_INTERFACECGI/1.1”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param:
“GATEWAY_INTERFACE: CGI/1.1”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy:
“SERVER_SOFTWARE”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy: “nginx/”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “0.7.59”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param:
“SERVER_SOFTWARE: nginx/0.7.59”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy: “REMOTE_ADDR”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “17.5.224.172”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: “REMOTE_ADDR:
17.5.224.172”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy: “REMOTE_PORT”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “4317”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: “REMOTE_PORT:
4317”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy: “SERVER_ADDR”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “12.55.8.61”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: “SERVER_ADDR:
12.55.8.61”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy: “SERVER_PORT”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var: “80”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: “SERVER_PORT: 80”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy: “SERVER_NAME”
2009/06/24 15:59:19 [debug] 9862#0: *11 http script var:
misc.mike.foo.com
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: “SERVER_NAME:
misc.mike.foo.com
2009/06/24 15:59:19 [debug] 9862#0: *11 http script copy:
“REDIRECT_STATUS200”
2009/06/24 15:59:19 [debug] 9862#0: *11 fastcgi param: “REDIRECT_STATUS:
200”
2009/06/24 15:59:19 [debug] 9862#0: *11 http cleanup add:
000000000146F5C8
2009/06/24 15:59:19 [debug] 9862#0: *11 get rr peer, try: 1
2009/06/24 15:59:19 [debug] 9862#0: *11 socket 18
2009/06/24 15:59:19 [debug] 9862#0: *11 epoll add connection: fd:18
ev:80000005
2009/06/24 15:59:19 [debug] 9862#0: *11 connect to 127.0.0.1:11001,
fd:18 #12
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream connect: -2
2009/06/24 15:59:19 [debug] 9862#0: *11 event timer add: 18:
60000:1245884419856
2009/06/24 15:59:19 [debug] 9862#0: *11 post event 00000000017F80A0
2009/06/24 15:59:19 [debug] 9862#0: *11 post event 00000000017F8038
2009/06/24 15:59:19 [debug] 9862#0: *11 delete posted event
00000000017F8038
2009/06/24 15:59:19 [debug] 9862#0: *11 http run request: “/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 http request empty handler
2009/06/24 15:59:19 [debug] 9862#0: *11 delete posted event
00000000017F80A0
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream request:
“/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream send request
handler
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream send request
2009/06/24 15:59:19 [debug] 9862#0: *11 chain writer buf fl:0 s:816
2009/06/24 15:59:19 [debug] 9862#0: *11 chain writer in:
000000000146F600
2009/06/24 15:59:19 [debug] 9862#0: *11 writev: 816
2009/06/24 15:59:19 [debug] 9862#0: *11 chain writer out:
0000000000000000
2009/06/24 15:59:19 [debug] 9862#0: *11 event timer del: 18:
1245884419856
2009/06/24 15:59:19 [debug] 9862#0: *11 event timer add: 18:
120000:1245884479857
2009/06/24 15:59:19 [debug] 9862#0: *11 post event 00000000017DE090
2009/06/24 15:59:19 [debug] 9862#0: *11 post event 00000000017F80A0
2009/06/24 15:59:19 [debug] 9862#0: *11 delete posted event
00000000017F80A0
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream request:
“/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream dummy handler
2009/06/24 15:59:19 [debug] 9862#0: *11 delete posted event
00000000017DE090
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream request:
“/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream process header
2009/06/24 15:59:19 [debug] 9862#0: *11 malloc: 0000000001799B20:4096
2009/06/24 15:59:19 [debug] 9862#0: *11 recv: fd:18 112 of 4096
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 01
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 06
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 00
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 01
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 00
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 65
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 03
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 00
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record length: 101
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi parser: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi header: “Status:
404 Not Found”
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi parser: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi header:
“X-Powered-By: PHP/5.2.10”
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi parser: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi header:
“Content-type: text/html”
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi parser: 1
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi header done
2009/06/24 15:59:19 [debug] 9862#0: *11 xslt filter header
2009/06/24 15:59:19 [debug] 9862#0: *11 HTTP/1.1 404 Not Found
Server: nginx
Date: Wed, 24 Jun 2009 22:59:19 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.2.10

2009/06/24 15:59:19 [debug] 9862#0: *11 write new buf t:1 f:0
000000000146F860, pos 000000000146F860, size: 219 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 http write filter: l:0 f:0 s:219
2009/06/24 15:59:19 [debug] 9862#0: *11 http cacheable: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream process upstream
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe read upstream: 1
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe preread: 28
2009/06/24 15:59:19 [debug] 9862#0: *11 readv: 1:3984
2009/06/24 15:59:19 [debug] 9862#0: *11 readv() not ready (11:
Resource temporarily unavailable)
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe recv chain: -2
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe buf free s:0 t:1 f:0
0000000001799B20, pos 0000000001799B74, size: 28 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe write downstream: 1
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe write busy: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe write:
out:0000000000000000, f:0
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe read upstream: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe buf free s:0 t:1 f:0
0000000001799B20, pos 0000000001799B74, size: 28 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 event timer: 18, old:
1245884479857, new: 1245884479858
2009/06/24 15:59:19 [debug] 9862#0: *11 post event 00000000017DE090
2009/06/24 15:59:19 [debug] 9862#0: *11 post event 00000000017F80A0
2009/06/24 15:59:19 [debug] 9862#0: *11 delete posted event
00000000017F80A0
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream request:
“/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream dummy handler
2009/06/24 15:59:19 [debug] 9862#0: *11 delete posted event
00000000017DE090
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream request:
“/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream process upstream
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe read upstream: 1
2009/06/24 15:59:19 [debug] 9862#0: *11 readv: 1:3984
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe recv chain: 16
2009/06/24 15:59:19 [debug] 9862#0: *11 readv: 1:3968
2009/06/24 15:59:19 [debug] 9862#0: *11 readv() not ready (11:
Resource temporarily unavailable)
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe recv chain: -2
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe buf free s:0 t:1 f:0
0000000001799B20, pos 0000000001799B74, size: 44 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe write downstream: 1
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe write busy: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe write:
out:0000000000000000, f:0
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe read upstream: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe buf free s:0 t:1 f:0
0000000001799B20, pos 0000000001799B74, size: 44 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 event timer: 18, old:
1245884479857, new: 1245884479858
2009/06/24 15:59:19 [debug] 9862#0: *11 post event 00000000017DE090
2009/06/24 15:59:19 [debug] 9862#0: *11 post event 00000000017F80A0
2009/06/24 15:59:19 [debug] 9862#0: *11 delete posted event
00000000017F80A0
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream request:
“/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream dummy handler
2009/06/24 15:59:19 [debug] 9862#0: *11 delete posted event
00000000017DE090
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream request:
“/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream process upstream
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe read upstream: 1
2009/06/24 15:59:19 [debug] 9862#0: *11 readv: 1:3968
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe recv chain: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe buf free s:0 t:1 f:0
0000000001799B20, pos 0000000001799B74, size: 44 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 input buf #0 0000000001799B74
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 01
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 03
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 00
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 01
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 00
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 08
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 00
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record byte: 00
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi record length: 8
2009/06/24 15:59:19 [debug] 9862#0: *11 http fastcgi sent end request
2009/06/24 15:59:19 [debug] 9862#0: *11 input buf 0000000001799B74 25
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe write downstream: 1
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe write downstream flush in
2009/06/24 15:59:19 [debug] 9862#0: *11 http output filter “/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 copy filter: “/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 xslt filter body
2009/06/24 15:59:19 [debug] 9862#0: *11 http postpone filter
“/index.php?” 000000000146FAA8
2009/06/24 15:59:19 [debug] 9862#0: *11 http chunk: 25
2009/06/24 15:59:19 [debug] 9862#0: *11 write old buf t:1 f:0
000000000146F860, pos 000000000146F860, size: 219 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 write new buf t:1 f:0
0000000000000000, pos 000000000146FB88, size: 4 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 write new buf t:1 f:0
0000000001799B20, pos 0000000001799B74, size: 25 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 write new buf t:0 f:0
0000000000000000, pos 000000000046E0FD, size: 2 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 http write filter: l:0 f:0 s:250
2009/06/24 15:59:19 [debug] 9862#0: *11 copy filter: 0 “/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 pipe write downstream done
2009/06/24 15:59:19 [debug] 9862#0: *11 event timer: 18, old:
1245884479857, new: 1245884479858
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream exit:
0000000000000000
2009/06/24 15:59:19 [debug] 9862#0: *11 finalize http upstream request:
0
2009/06/24 15:59:19 [debug] 9862#0: *11 finalize http fastcgi request
2009/06/24 15:59:19 [debug] 9862#0: *11 free rr peer 1 0
2009/06/24 15:59:19 [debug] 9862#0: *11 close http upstream connection:
18
2009/06/24 15:59:19 [debug] 9862#0: *11 event timer del: 18:
1245884479857
2009/06/24 15:59:19 [debug] 9862#0: *11 http upstream temp fd: -1
2009/06/24 15:59:19 [debug] 9862#0: *11 http output filter “/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 copy filter: “/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 xslt filter body
2009/06/24 15:59:19 [debug] 9862#0: *11 http postpone filter
“/index.php?” 00007FFF4554CC70
2009/06/24 15:59:19 [debug] 9862#0: *11 http chunk: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 write old buf t:1 f:0
000000000146F860, pos 000000000146F860, size: 219 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 write old buf t:1 f:0
0000000000000000, pos 000000000146FB88, size: 4 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 write old buf t:1 f:0
0000000001799B20, pos 0000000001799B74, size: 25 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 write old buf t:0 f:0
0000000000000000, pos 000000000046E0FD, size: 2 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 write new buf t:0 f:0
0000000000000000, pos 000000000046E0FA, size: 5 file: 0, size: 0
2009/06/24 15:59:19 [debug] 9862#0: *11 http write filter: l:1 f:0 s:255
2009/06/24 15:59:19 [debug] 9862#0: *11 http write filter limit 0
2009/06/24 15:59:19 [debug] 9862#0: *11 writev: 255
2009/06/24 15:59:19 [debug] 9862#0: *11 http write filter
0000000000000000
2009/06/24 15:59:19 [debug] 9862#0: *11 copy filter: 0 “/index.php?”
2009/06/24 15:59:19 [debug] 9862#0: *11 http finalize request: 0,
“/index.php?” 1
2009/06/24 15:59:19 [debug] 9862#0: *11 set http keepalive handler
2009/06/24 15:59:19 [debug] 9862#0: *11 http close request
2009/06/24 15:59:19 [debug] 9862#0: *11 http log handler
2009/06/24 15:59:19 [debug] 9862#0: *11 free: 0000000001799B20
2009/06/24 15:59:19 [debug] 9862#0: *11 free: 0000000000F92A20, unused:
3
2009/06/24 15:59:19 [debug] 9862#0: *11 free: 000000000146EE30, unused:
72
2009/06/24 15:59:19 [debug] 9862#0: *11 event timer add: 17:
30000:1245884389858
2009/06/24 15:59:19 [debug] 9862#0: *11 free: 0000000000CC7300
2009/06/24 15:59:19 [debug] 9862#0: *11 free: 000000000107CE00
2009/06/24 15:59:19 [debug] 9862#0: *11 hc free: 0000000000000000 0
2009/06/24 15:59:19 [debug] 9862#0: *11 hc busy: 0000000000000000 0
2009/06/24 15:59:19 [debug] 9862#0: *11 tcp_nodelay
2009/06/24 15:59:19 [debug] 9862#0: *11 post event 00000000017DE028
2009/06/24 15:59:19 [debug] 9862#0: *11 delete posted event
00000000017DE028
2009/06/24 15:59:19 [debug] 9862#0: *11 http keepalive handler
2009/06/24 15:59:19 [debug] 9862#0: *11 malloc: 0000000000D9C1A0:8192
2009/06/24 15:59:19 [debug] 9862#0: *11 recv: fd:17 -1 of 8192
2009/06/24 15:59:19 [debug] 9862#0: *11 recv() not ready (11: Resource
temporarily unavailable)

Hello!

On Wed, Jun 24, 2009 at 04:03:14PM -0700, Michael S. wrote:

server {
listen 80;
index index.php index.html;
server_name ~^(.*?).mike.foo.com$;
set $name $1;

The problem is that as long as any internal redirect happens -
server-level rewrites will be re-executed, including “set $name
$1;” with $1 being from last regexp match.

Basically it’s fragile construction and should be avoided for
anything but really simple configs.

Maxim D.

So there is no way to dynamically do this?

what is odd is if i request http://misc.mike.foo.com/index.php it works
fine. but http://misc.mike.foo.com/ by itself gives me the “no input
file
specified” due to SCRIPT_FILENAME missing the capture.
why would it work for one and not the other?

On Wed, Jun 24, 2009 at 7:49 PM, Maxim D. [email protected]
wrote:

  }
This doesn’t seem to work for me.

server {
listen 80;
index index.php index.html;
server_name ~^(.*?).%%USER%%.foo.com$;

    set $name $1;
    root /home/%%USER%%/web/$name;

set $name “”;

if ($host ~^(.*?).%%USER%%.foo.com$) {

set $name $1;

}

            location / { }
            include /etc/nginx/defaults.conf;
            include /etc/nginx/confs/development.conf;
            include /etc/nginx/expires.conf;
            location ~ \.php$ {
                    include /etc/nginx/fastcgi.conf;
                    fastcgi_pass 127.0.0.1:%%PORT%%;
            }
            try_files $uri $uri/ /controller.php?uri=$uri&$args;
}

Location isn’t allowed inside of an “if”

$host isn’t recognized: [emerg]: invalid condition “$host” in
/etc/nginx/nginx.conf

etc…

Hello!

On Wed, Jun 24, 2009 at 08:12:40PM -0700, Michael S. wrote:

    set $name $1;
    root /home/%%USER%%/web/$name;

set $name “”;

if ($host ~^(.*?).%%USER%%.foo.com$) {

  •     if ($host ~^(.*?)\.%%USER%%\.foo\.com$) {
    
  •     if ($host ~ ^(.*?)\.%%USER%%\.foo\.com$) {
    

Maxim D.

Hello!

On Wed, Jun 24, 2009 at 05:29:41PM -0700, Michael S. wrote:

what is odd is if i request http://misc.mike.foo.com/index.php it works
fine.

There is no internal redirect in this case.

but http://misc.mike.foo.com/ by itself gives me the “no input file
specified” due to SCRIPT_FILENAME missing the capture.

Here internal redirect to /index.php happens.

why would it work for one and not the other?

See above.

On Wed, Jun 24, 2009 at 4:41 PM, Michael S. [email protected] wrote:

So there is no way to dynamically do this?

Something like

server {
    listen 80;
    server_name ~^(.*?)\.mike\.foo\.com$;

    set $name "";
    if ($host ~ ^(.*?)\.mike\.foo\.com$) {
        set $name $1;
    }

    ...
}

will do the trick. This will do an extra unneeded regexp match in
the first case (/index.php request without internal redirect) and
shouldn’t be shown to Igor (as it uses if :)), but it will work in
second case too (/ request with internal redirect to /index.php).

Maxim D.

2009/6/24 Maxim D. [email protected]

  •     if ($host ~^(.*?)\.%%USER%%\.foo\.com$) {
    
  •     if ($host ~ ^(.*?)\.%%USER%%\.foo\.com$) {
    

That at least passes but it still doesn’t work.

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name the
$document_root piece is not being filled in from the “root” capture. It
probably should… that’d be a bug if it was up to me.

For the moment I’ve been able to make a crappy hack:

rewrite ^/$ /index.php last;