FastCGI+PHP - Script_Name

Jonathan Vanasco nginx at 2xlp.com
Sat Dec 9 20:11:32 MSK 2006


I'm trying to emulate the behavior of SERVER['SCRIPT_NAME'] of apache/ 
mod_php under nginx/fastcgi+php -- specifically in the situation  
where a rewrite rule is involved.   i'm offloading a page from  
mod_perl onto php, and can't figure out how to migrate this code (it  
works on mod_php on a dev box)

under apache-

	url:	findmeon.com/user/123456/
	file:	/user/index.php
	rewrite rule:
		RewriteRule ^/user/([a-z0-9]{4,16})(\/[.]*)?$ /user/index.php?&% 
{QUERY_STRING}&fmo_mode=user&fmo_user=$1 [T=application/x-httpd-php,L]
		
	result:
		SERVER['SCRIPT_NAME']= /user/$1/index.php
	
under nginx

	url:	findmeon.com/user/123456/
	file:	/user/index.php
	rewrite rule:
		rewrite "^/user/([a-z0-9]{4,16})(\/[.]*)?$" /user/index.php?& 
$query_string&fmo_mode=user&fmo_user=$1 last;
	config:		
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

	result:
		SERVER['SCRIPT_NAME']= /user/index.php
	
nginx + fastcgi are doing exactly as they should.

i just need to figure out how to change the config like for  
"fastcgi_param  SCRIPT_NAME" to reflect the pre-rewrite rule script  
name (which is what apache does)



// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -







More information about the nginx mailing list