Nginx rewrite for Maxsite CMS

Igor Sysoev igor на sysoev.ru
Чт Фев 3 13:13:41 MSK 2011


On Thu, Feb 03, 2011 at 04:37:05AM -0500, xopek wrote:

> Мне подсказали в другом месте и вот
> окончательный вариант для maxsite cms :)
> [code]
> server {
>         listen 80;
>         server_name site.ru;
>         location ~ \.php {
>          fastcgi_pass  unix:/tmp/php-fpm.sock;
>          fastcgi_index index.php;
>          include fastcgi_params;
>          fastcgi_param SCRIPT_FILENAME
> /path/to/maxsite$fastcgi_script_name;
>          fastcgi_param PATH_INFO $fastcgi_script_name;
>          access_log off;
>       }
> 
>       location / {
>         root /path/to/maxsite;
>          index  index.php;
> 
>         if (-f $request_filename) {
>             expires max;
>             break;
>         }
> 
>          if (!-e $request_filename){
>             rewrite (.*) /index.php/$1;
>          }
>       }
> 
> }
> [/code]
> Всем спасибо ;)

Это неправильная конфигурация, вот правильная:

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

       location ~ \.php {
          fastcgi_pass  unix:/tmp/php-fpm.sock;
          fastcgi_index index.php;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME
                        /path/to/maxsite$fastcgi_script_name;
          fastcgi_param PATH_INFO $fastcgi_script_name;
       }

       location @maxsite {
          fastcgi_pass  unix:/tmp/php-fpm.sock;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME
                        /path/to/maxsite/index.php;
          fastcgi_param PATH_INFO /index.php$uri;
       }


-- 
Igor Sysoev
http://sysoev.ru/en/



Подробная информация о списке рассылки nginx-ru