drupal try_files php fastcgi

Cliff Wells cliff at develix.com
Mon Mar 16 20:22:22 MSK 2009


On Mon, 2009-03-16 at 20:12 +0300, Igor Sysoev wrote:
> On Mon, Mar 16, 2009 at 09:51:55AM -0700, Cliff Wells wrote:
> 
> > http://wiki.nginx.org/NginxJoomla
> > 
> > I find that basic recipe works for a lot of PHP frameworks.
> 
> Does Joomla require "/index.php?q=$request_uri" ?
> When I have checked on their site, just /index.php was enough.

No idea.  I've only installed it for a few sites and with limited
testing (I quit testing when it worked ;-)

> It's better to use try_files:
> 
> root  /path/to/root;
> 
> location / {
>     try_files      $uri  $uri/  @fallback;
> }
> 
> location ~ \.php$ {
>     try_files      $uri  @fallback;
> 
>     fastcgi_pass   ...;
> 
>     fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
>     # or just
>     #    fastcgi_param  SCRIPT_FILENAME  $document_root$uri;
>     # as here $fastcgi_script_name == $uri
>     fastcgi_param  QUERY_STRING     $query_string;
> 
>     # other fastcgi_param's
> }
> 
> location @fallback {
>     fastcgi_pass   ...;
> 
>     fastcgi_param  SCRIPT_FILENAME  $document_root/index.php;
>     fastcgi_param  QUERY_STRING     q=$request_uri;
> 
>     # other fastcgi_param's
> }
> 
> Probably, you can use omit @fallback:
> 
> location / {
>     try_files      $uri  $uri/  /index.php?q=$request_uri;
> }
> 
> location ~ \.php$ {
>     try_files      $uri  /index.php?q=$request_uri;
>     ...
> }

Thanks, 

I'll give this a try and update the wiki.

Cliff








More information about the nginx mailing list