Welcome! Log In Create A New Profile

Advanced

map uri fastcgi_pass

September 17, 2014 04:25AM
Здравствуйте, есть задача: перенаправить запрос c uri вида /some/path/03_dfsakfa на бекенд server03.domain.tld с номером 03(берется из uri).
Все остальные запросы надо отправлять на upstream fpm.

OS Debian 7.6
nginx version: nginx/1.2.1

При перезапуске nginx получаю ошибку:
Restarting nginx: nginx: [emerg] invalid number of the map parameters in /etc/nginx/nginx.conf

Подскажите, что я делаю неправильно, где ошибка?

nginx.conf

http {
...
...
upstream fpm {
server 1.1.1.1:9001;
server 2.2.2.2:9001;
}

map $uri $back {
default "fpm";
~*"/some/path/(?<key>^\d{2})$(.+)$" server$key\.domain\.tld;

}
...
...
server {
...
location / {
root /some/path;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?$args last;
break;
}

location ~ \.php$ {
include fastcgi_params;
root /some/path;
fastcgi_pass $back;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Subject Author Posted

map uri fastcgi_pass

Nikolay September 17, 2014 04:25AM

Re: map uri fastcgi_pass

Валентин Бартенев September 17, 2014 04:48AM

Re: map uri fastcgi_pass

Nikolay September 17, 2014 05:37AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 86
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready