php and urls with /?xxx

Francis Daly francis at daoine.org
Sat Nov 19 15:46:54 UTC 2011


On Fri, Nov 18, 2011 at 06:31:51PM -0500, Salem wrote:

Hi there,

> For Wordpress-Urls like /index.php/xxx/ 
> try_files $uri $uri/ /index.php?q=$request_uri;
> works fine, but for /?

The "location" goes from the / to just before the first ? or #.

You want this to be handled as if it were /index.php?xxx=xxx. So do
just that.

  location = / {
    fastcgi_pass  unix:php.sock;
    include fastcgi.conf;
    fastcgi_param SCRIPT_FILENAME /htdocs/index.php;
  }

The SCRIPT_FILENAME would normally be $document_root/index.php, but you
mention elsewhere that chroot is used. SCRIPT_FILENAME is "the name of
the file the php interpreter should load, from its perspective".

(If you did fastcgi_pass to a different server, the filename on
that server would be what you would send. Which may be unrelated to
$document_root.)


Maybe just adding

  index index.php;

within the server{} block instead, would be sufficient.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list