How to configure nginx to proxy requests for the mapping table?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
7 views
I have 2 Apache server: a_1 and a_2
There is a table of correspondences
Server | Address
a_1 | 1
a_1 | 2
a_1 | 3
a_2 | 4
a_2 | 5
a_2 | 6

On the front of the address looks like this:

/a/1
where a - indicates that the server
, 1 - the address of the page

How to make nginx when specifying the page address was redirected to need apache.
The number of apache servers and changing pages, but it is known in the mapping table on any of the servers what the page is.
One and the same page can't be on different servers.
by | 7 views

1 Answer

0 like 0 dislike
Sketch, the validity is not checked.
server { map $uri $apache_host { ~ ^/a/1 a_1 ~ ^/a/2 a_1 ~ ^/a/3 a_1 ~ ^/a/4 a_2 ~ ^/a/5 a_2 ~ ^/a/6 a_2 } if ($apache_host) { proxy_pass $apache_host; } }
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
28,052 users