| From | Sent On | Attachments |
|---|---|---|
| freejack | Jan 4, 2012 2:29 pm | |
| Francis Daly | Jan 4, 2012 2:56 pm | |
| freejack | Jan 4, 2012 3:15 pm |
| Subject: | Re: Trailing slash being removed from document root | |
|---|---|---|
| From: | Francis Daly (fran...@daoine.org) | |
| Date: | Jan 4, 2012 2:56:18 pm | |
| List: | ru.sysoev.nginx | |
On Wed, Jan 04, 2012 at 05:30:42PM -0500, freejack wrote:
Hi there,
When getting the document root in PHP from nginx using this:
$_SERVER['DOCUMENT_ROOT']."../".$ZONE."/".$LOCALE...etc......
nginx will always return the path WITHOUT the trailing slash.
nginx doesn't do PHP, it does fastcgi. Which means that it sends a series of key/value params to the fastcgi server, which in turn presents them to your PHP in the _SERVER array.
Which in turn means that...
We have way too much code in php that gets the document root without adding a trailing slash after $_SERVER['DOCUMENT_ROOT'] because lighttpd and apache before that always had preserved the trailing slash.
How can I configure nginx to keep the slash?
...wherever you currently set "fastcgi_param DOCUMENT_ROOT" (probably from "include fastcgi.conf"), add the slash there and it all should Just Work.
That is:
you probably have
fastcgi_param DOCUMENT_ROOT $document_root;
Change it to be
fastcgi_param DOCUMENT_ROOT $document_root/;
and on nginx -s reload, you should see the difference.
f
-- Francis Daly fran...@daoine.org
_______________________________________________ nginx mailing list ngi...@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx





