Problems with fastcgi php migration

Philip Ratzsch philip.ratzsch at rackspace.com
Sun Mar 9 10:25:27 MSK 2008


Ian & all,

>That's one idea, but right now I don't want to add a new layer in.

Fair enough.  If at some point you decide to go that route, know that it's amazingly easy to configure.

>You mean something along the lines of a location specifically for the 
>extensionless filenames (galleries|polls|reviews|etc) with 
>fastcgi_params just for them? And another location for php|shtml?
>[Note how I don't even try to write the regex's...(clip)]

I've never done anything with FCGI, so rather than risk using the wrong terminology, I'll just try my hand at an example.

[Caveat - in my limited experience, the rewrite engine in Nginx uses a very similar syntax to Apache's mod_rewrite module, so I'm hoping this is close enough that someone with more knowledge than I can correct any mistakes.  This does not take proxying into account, and simply serves as a logic example.  These are not the droids you're looking for.]

If for example, your 'gallery' section took two parameters, a three-digit number and a two-digit number, the logic would be:

A line that matches ^/gallery/(\d{3})/(\d{2})$
(Start matching when you see '/gallery/xxx/yy' and then stop)

...would be proxied to http://your_upstream_server/file_that_handles_gallery_requests?three-digit-number=$1&two-digit-number=$2

The same thing could be done for polls, again for reviews, et al.

In the above regex, notice that the \d{3} and \d{2} which match three digits and two digits respectively, are wrapped in parentheses.  The parentheses allow you to use what are called back references ($1 and $2 in this case), which allow you to grab the chunks of the URL that match that specific chunk of the pattern and use them later.  An example might be better: if you had a URL of http://blah.com/gallery/222/33, $1 would represent 222 and $2 would be 33.

I hope I haven't completely obfuscated what I'm trying to communicate.  I think that the link below documents a guy having a similar problem, or at least one that may be close enough for your purposes.

http://www.ruby-forum.com/topic/144179

I hope this is of some help.
--
Philip Ratzsch
Software Engineer Developer I
Information Systems, Rackspace

Opinions expressed are mine and do not necessarily reflect those of my employer.




Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace. 
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at abuse at rackspace.com, and delete the original message. 
Your cooperation is appreciated.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3956 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx/attachments/20080309/4d9e657d/attachment.bin>


More information about the nginx mailing list