15 messages in ru.sysoev.nginxRe: php and locations with regex (rou...
FromSent OnAttachments
Alejandro VartabedianOct 23, 2007 3:43 am 
Alejandro VartabedianOct 23, 2007 7:16 am 
Igor SysoevOct 23, 2007 7:29 am 
Maxim DouninOct 23, 2007 7:33 am 
Alejandro VartabedianOct 23, 2007 7:42 am 
Alejandro VartabedianOct 23, 2007 7:44 am 
Alejandro VartabedianOct 23, 2007 8:37 am 
Grzegorz NosekOct 23, 2007 8:43 am 
Alejandro VartabedianOct 23, 2007 9:25 am 
Igor SysoevOct 23, 2007 9:33 am 
Alejandro VartabedianOct 23, 2007 10:55 am 
Grzegorz NosekOct 24, 2007 1:31 am 
Igor SysoevOct 24, 2007 3:00 am 
Igor SysoevOct 24, 2007 3:23 am 
Alejandro VartabedianOct 24, 2007 5:40 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: php and locations with regex (round 2)Actions...
From:Alejandro Vartabedian (list@public.gmane.org)
Date:Oct 23, 2007 7:42:00 am
List:ru.sysoev.nginx

only a simple question about the topic: Are regexed locations rules accumulative? because it seems that when the two locations rules i want to be matched are regexed ones only one is matched.

i'll read more docs... thanks...

(trying to pay attention to the data i posting...)

well, i think i found a behavior pattern with my problem about regexed locations and php scripts. i tried very simple tests to figure out the behavior i getting from the server. the case is this: _ 2 subdirs, app1 and app2 _ 2 files in each subdir index.html (hello world) and index.php (phpinfo) _ 2 different locations configs, with and without regex _ 2 different indexes en each app subdir, app1->index.php and app2->index.html

config 1:

server { listen 80; server_name www.beta; #somename alias another.alias;

# access_log /var/log/nginx/beta.access.log;

location / { root /home/website/beta.ws/webroot/; index index.php index.html index.htm; }

location /app1/ { root /home/website/beta.ws/webroot/; index index.php index.html index.htm; }

location /app2/ { root /home/website/beta.ws/webroot/; index index.html index.htm; }

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:8888 # location ~ .php$ { fastcgi_pass 127.0.0.1:8888; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/website/beta.ws/webroot$fastcgi_script_name; include /etc/nginx/fastcgi_params; }

} the behavior is as expected:

http://www.beta/app1/ => index.php's phpinfo output http://www.beta/app2/ => index.html's html hello world output

http://www.beta/app1/index.php => index.php's phpinfo output http://www.beta/app2/index.php => index.php's phpinfo output

until now all is ok.

now the config with a _minimal_ regex variation: server { listen 80; server_name www.beta; #somename alias another.alias;

# access_log /var/log/nginx/beta.access.log;

location / { root /home/website/beta.ws/webroot/; index index.php index.html index.htm; }

location ~ ^/(app1)/ { root /home/website/beta.ws/webroot/; index index.php index.html index.htm; }

location ~ ^/(app2)/ { root /home/website/beta.ws/webroot/; index index.html index.htm; }

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:8888 # location ~ .php$ { fastcgi_pass 127.0.0.1:8888; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/website/beta.ws/webroot$fastcgi_script_name; include /etc/nginx/fastcgi_params; }

}

the behavior isn't as expected:

http://www.beta/app1/ => BIN file to download, 13ax1epp.bin containing the index.php source code http://www.beta/app2/ => index.html's html hello world output

http://www.beta/app1/index.php => index.php's source code with a correct mime recognition http://www.beta/app2/index.php => index.php's source code with a correct mime recognition

well, it seems that as an automatic index the php file is returned with some internal file name? with a .bin extension for download, containing the script source code. but if it's called directly by the browser url it's returned with the correct name but without been parsed by the fastcgi.

i hope it could be of help.