at the moment i use a “location .php {}” block for opening php-files
through fastcgi_pass. But what’s the right way for
calls like www.xxx.xxx/?xxx=xxx ?
For Wordpress-Urls like /index.php/xxx/
try_files $uri $uri/ /index.php?q=$request_uri;
works fine, but for /?
at the moment i use a “location .php {}” block for opening
php-files through fastcgi_pass. But what’s the right way for calls
like www.xxx.xxx/?xxx=xxx ?
For Wordpress-Urls like /index.php/xxx/
try_files $uri $uri/ /index.php?q=$request_uri;
works fine, but for /?
Try this:
## Regular PHP processing.
location ~ ^(?<script>.+\.php)(?<path_info>.*)$ {
include fastcgi.conf;
## The fastcgi_params must be redefined from the ones
## given in fastcgi.conf. No longer standard names
## but arbitrary: named patterns in regex.
fastcgi_param SCRIPT_FILENAME $document_root$script;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param PATH_INFO $path_info;
## Passing the request upstream to the FastCGI
## listener.
fastcgi_pass phpcgi;
}
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.