Nginx rewrite expression dilemma

Hi,

Having following apache config working:

=========================================================

<Directory /data/www/dev/domain.com/cf/htdocs/get>
    Options FollowSymlinks
    RewriteEngine on
    RewriteRule ^([^/\.]+)/([^/]+)$ index.php?contid=$1 [L]
</Directory>

=========================================================

Rewrite works properly, when pointing to domain.com/get/aa/bb

I can’t get this working properly in nginx using the following config:
When I enter URL that works in apache, nginx returns with 404.

=========================================================
upstream cf-domain {

    server unix:/data/www/dev/domain.com/cf/cf-domain.sock;

}

server {
listen 62.236.108.22:80;
listen 127.0.0.1:28005;
server_name cfdev.domain.com;
access_log
/data/www/dev/domain.com/cf/logs/frontend/access.log;
error_log /data/www/dev/domain.com/cf/logs/frontend/error.log;

    charset utf-8;

    location ~ ^/get/ {
            rewrite ^([^/\.]+)/([^/]+)$ index.php?contid=$1 last;
            fastcgi_pass cf-domain;
    }

    location / {
            root /data/www/dev/domain.com/cf/htdocs;
            index index.php index.html;

            if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)$") {
                    expires max;
            }

            if (!-f $request_filename) {
                    rewrite  ^/(.*)$  /index.php?q=$1  last;
                    break;
            }
    }

    location ~ (\.php)$ {
            fastcgi_param SCRIPT_FILENAME

/data/www/dev/domain.com/cf/htdocs$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_pass cf-domain;
}

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root html;
    }

}

=========================================================

I suspect I need to amend processing order or rewrite, but can’t seem to
find the right way. Can you please help me to find where the error is?

Posted at Nginx Forum: