server { server_name .hg.pydev.ru; root /web; location / { if ($request_method = POST) { rewrite (.*) /__post$1 last; } if ($request_method != POST) { rewrite (.*) /__get$1 last; } } location ~ ^/__get { rewrite ^/__get(.*) $1 break; include fastcgi_params; fastcgi_param PATH_INFO $uri; fastcgi_param SCRIPT_NAME ''; fastcgi_pass unix:/var/run/www/hg.pydev.ru.sock; } location ~ ^/__post { auth_basic "closed site"; auth_basic_user_file /web/hg.passwd; rewrite ^/__post(.*) $1 break; include fastcgi_params; fastcgi_param PATH_INFO $uri; fastcgi_param SCRIPT_NAME ''; fastcgi_param REMOTE_USER $remote_user; fastcgi_pass unix:/var/run/www/hg.pydev.ru.sock; } }