nginx try_files & drupal

Vasiliy G Tolstov v.tolstov at selfip.ru
Fri Oct 9 13:09:16 MSD 2009


В Птн, 09/10/2009 в 12:10 +0400, Vasiliy G Tolstov пишет:

> Да, теперь работает вроде все.
> 


То есть для drupal готовый варинант с try_files таков:

  location / {
    try_files      $uri  $uri/ @drupal;
  }

  location ~ \.php$ {
    try_files      $uri  @drupal;
    fastcgi_pass   ...............;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        /etc/nginx/fastcgi_params; #файл идет по-умолчанию
  }


location @drupal {
    fastcgi_pass   unix:/var/run/php/selfip.ru;
    fastcgi_param  SCRIPT_FILENAME  $document_root/index.php;
    fastcgi_param  QUERY_STRING     q=$uri&$args;

    fastcgi_param  SCRIPT_NAME   /index.php;
    fastcgi_param  DOCUMENT_URI  $uri;

    fastcgi_param  REQUEST_METHOD     $request_method;
    fastcgi_param  CONTENT_TYPE       $content_type;
    fastcgi_param  CONTENT_LENGTH     $content_length;

    fastcgi_param  REQUEST_URI        $request_uri;
    fastcgi_param  DOCUMENT_URI       $document_uri;
    fastcgi_param  DOCUMENT_ROOT      $document_root;
    fastcgi_param  SERVER_PROTOCOL    $server_protocol;

    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
    fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

    fastcgi_param  REMOTE_ADDR        $remote_addr;
    fastcgi_param  REMOTE_PORT        $remote_port;
    fastcgi_param  SERVER_ADDR        $server_addr;
    fastcgi_param  SERVER_PORT        $server_port;
    fastcgi_param  SERVER_NAME        $server_name;

    fastcgi_param  REDIRECT_STATUS    200;
}


А на сколько @drupal такой лучше/хуже по производительности и идеологии
будущих верси nginx по сравнению с 

  location @drupal {
    rewrite ^/(.*)$ /index.php?q=$1 last;
  }


-- 
Vasiliy G Tolstov <v.tolstov at selfip.ru>
Selfip.Ru






More information about the nginx-ru mailing list