nginx-0.7.27

Marcos Neves marcos.neves at gmail.com
Mon Dec 15 17:39:57 MSK 2008


try_files will be very usefu!!
Can it be used outside location context?


Marcos Neves
+55 44 3263-8132
+55 44 9918-8488



2008/12/15 Igor Sysoev <is at rambler-co.ru>:
> On Mon, Dec 15, 2008 at 12:04:45PM -0200, Marcos Neves wrote:
>
>> Where can I found examples about how to use try_files and variables
>> support in the "fastcgi_pass" directive?
>
> fastcgi_pass variable usage (just demonstration):
>
>        location \.php$ {
>            resolver      127.0.0.1;
>            set           $backend   back1:9000;
>            fastcgi_pass  $backend;
>        }
>
> back1 will be resolved using named server on 127.0.0.1.
> You may also describe back1 upstream to disable onfly resolution:
>
>    upstream  back1 {
>        server   192.168.1.1:9000;
>    }
>
>    server {
>
>        location \.php$ {
>            set           $backend   back1;
>            fastcgi_pass  $backend;
>        }
>
> or just use IP address:
>
>        location \.php$ {
>            set           $backend   192.168.1.1:9000;
>            fastcgi_pass  $backend;
>        }
>
>
> try_files:
>
> Mongrel:
>
> location / {
>    try_files      /system/maintenance.html
>                   $uri  $uri/index.html  $uri.html
>                   @mongrel;
> }
>
> location @mogrel {
>    proxy_pass     http://mongrel;
> }
>
>
> Drupal/FastCGI:
>
> location / {
>    try_files      $uri  @drupal;
> }
>
> location ~ \.php$ {
>    try_files      $uri  @drupal;
>
>    fastcgi_param  SCRIPT_FILENAME  /path/to/$uri;
>    ... other fastcgi_param
> }
>
> location = @drupal {
>    fastcgi_pass   ...;
>
>    fastcgi_param  SCRIPT_FILENAME  /path/to/index.php;
>    fastcgi_param  QUERY_STRING     q=$request_uri;
>
>    ... other fastcgi_param
> }
>
>
> Joomla/FastCGI:
>
> location / {
>    try_files      $uri  @joomla;
> }
>
> location ~ \.php$ {
>    try_files      $uri  @joomla;
>
>    fastcgi_param  SCRIPT_FILENAME  /path/to/$uri;
>    ... other fastcgi_param
> }
>
> location = @joomla {
>    fastcgi_pass   ...;
>
>    fastcgi_param  SCRIPT_FILENAME  /path/to/index.php;
>
>    ... other fastcgi_param
> }
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
>





More information about the nginx mailing list