putting stupid search engine urls back

Marcus Clyne maccaday at gmail.com
Sun Aug 30 18:53:09 MSD 2009


AMP Admin wrote:
> I think something's missing from that so I've tried the following but no
> luck.  Thoughts?
>   
You will need to add the fastcgi_pass setting relevant for you.  The 
other settings are optional.

If you've used

include fastcgi_params;

then you've probably got a setting

fastcgi_param  SCRIPT_FILENAME xxx

in there.  This will over-ride the one mentioned below, so it won't 
work.  You need to remove it.

There's no need to do a rewrite - setting the script filename from the 
regex location is more efficient.
> location ~ ^.*-t([0-9]+).html$ {
> 	fastcgi_index			index.php;
> 	fastcgi_pass			127.0.0.1:2000;
> 	include				fastcgi_params;
> 	fastcgi_intercept_errors	On;
> 	fastcgi_ignore_client_abort	On;
> 	fastcgi_buffer_size   		128k;
> 	fastcgi_buffers       		4 128k;	
> 	rewrite ~ ^.*-t([0-9]+).html$ /path/to/stuff/showthread.php?t=$1
> last;
>     }
>
>   
As an extra note, having fastcgi_index here will have no effect - the 
regex ends in .html, so would never be used.

Try :

location ~ -t([0-9]+).html$ {
       	fastcgi_pass   			127.0.0.1:2000;
       	fastcgi_param SCRIPT_FILENAME  /path/to/document/root/showthread.php?t=$1;
	include 			fastcgi_params;	 # no fastcgi_param SCRIPT_FILENAME  setting in this file!!!
	fastcgi_intercept_errors	On;
	fastcgi_ignore_client_abort	On;
	fastcgi_buffer_size   		128k;
	fastcgi_buffers       		4 128k;
}


Marcus.





More information about the nginx mailing list