nginx reescreve throw 404 com last e break

1

Eu tenho um host virtual como abaixo para o meu site Yii

server {
        root /var/www/code;
        index  index.php index.html;
        server_name example.com;
        location / {
           rewrite ^/en/keyword$ /en/spesfic_controller/ last;
           ....
         }
}

se eu usar última ou quebra na regra de reescrita acima, nginx gera erro 404, mas se eu alterá-la para permanente , irá redirecioná-lo e vai funcionar bem !! o que pode estar errado? ou o que eu perdi? (nada no log de erros)
EDITAR
o host virtual completo está abaixo:

server {
    listen       80;
        root /var/www/code;
        index  index.php index.html;
server_name example.com;
location / {
        rewrite ^/[/]*$ /ar/ permanent;
        proxy_set_header Accept-Encoding "";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php?q=$1 last;
                }
        }
        rewrite ^/en/jobs-in-riyadh$ "/en/jobs/SearchResult/city_id/a:1:%7Bi:0;s:2:%2210%22;%7D" last;

        error_log /var/log/nginx/error.log warn;
        access_log /var/log/nginx/access.log;
        if ($http_user_agent ~ libwww-perl) {
              return 403;
        }
        location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|ttf|woff)$ {
                access_log        off;
                log_not_found     off;
                expires          max; #you can set it to something like 30d;
                add_header Pragma public;
                add_header Cache-Control "public"; #you can set more than one COMMA seperated ", must-revalidate, proxy-revalidate";
        }
        location ~ \.php$ {
                include /etc/nginx/fastcgi_params;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param  SCRIPT_FILENAME  /var/www/code/$fastcgi_script_name;
                fastcgi_buffer_size 4k;
                fastcgi_buffers 256 4k;
                fastcgi_max_temp_file_size 0;
                proxy_buffering off;
                send_timeout 180s;
                proxy_read_timeout 120s;
                proxy_connect_timeout 120s;
                fastcgi_send_timeout 120s;
                fastcgi_read_timeout 120s;
                fastcgi_connect_timeout 120s;
        }
        location ~ /\. {
            access_log off;
            log_not_found off;
            deny all;
        }
}
    
por Alaa Alomari 07.12.2014 / 13:10

0 respostas