Welcome! Log In Create A New Profile

Advanced

Re: php and urls with /?xxx

António P. P. Almeida
November 18, 2011 08:40PM
On 18 Nov 2011 23h31 WET, nginx-forum@nginx.us wrote:

> Ahoi,
>
> 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;
}

Combined with:

location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}

Of course you have to fill in the details on static file handling,
blocking the readme.html file, etc.

--- appa

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

php and urls with /?xxx

Salem November 18, 2011 06:31PM

Re: php and urls with /?xxx

António P. P. Almeida November 18, 2011 08:40PM

Re: php and urls with /?xxx

Salem November 18, 2011 10:04PM

Re: php and urls with /?xxx

Edho Arief November 18, 2011 10:12PM

Re: php and urls with /?xxx

Edho Arief November 18, 2011 10:16PM

Re: php and urls with /?xxx

Salem November 19, 2011 08:56AM

Re: php and urls with /?xxx

Francis Daly November 19, 2011 10:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 306
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready