<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On 04 Nov 2015, at 13:45, Alex Domoradov <<a href="mailto:alex.hha@gmail.com">alex.hha@gmail.com</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Столкнулся с проблемой необходимости перевести apache на nginx. На данный момент в apache в настройках виртуалхоста есть директивы<br><br>ProxyPassReverse / <a href="http://javaclr.example.net/">http://javaclr.example.net/</a><br>ProxyPassReverse / <a href="http://imagesclr.example.net/">http://imagesclr.example.net/</a><br>ProxyPassReverse / <a href="http://aspclr.example.net/">http://aspclr.example.net/</a><br>ProxyPassReverse / <a href="http://vsclr.example.net/">http://vsclr.example.net/</a><br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">В офф документации nginx - <a href="https://www.nginx.com/resources/wiki/start/topics/examples/likeapache/">https://www.nginx.com/resources/wiki/start/topics/examples/likeapache/</a> говорится, что достаточно использовать proxy_pass и передавать соотв хедеры.<br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Но тут возникает вопрос, а как мне в одном location использовать несколько директив proxy_pass. Или единственный выход использовать map, что то вида<br><br>map $host $proxy_host {<br>    default "";<br>  "~(javaclr|imagesclr|aspclr|vsclr)\.example\.net" "$host";<br>}<br><br>server {<br>    listen 80;<br>    server_name  <a href="http://javaclr.example.net/">javaclr.example.net</a> <a href="http://imagesclr.example.net/">imagesclr.example.net</a> <a href="http://aspclr.example.net/">aspclr.example.net</a> <a href="http://vsclr.example.net/">vsclr.example.net</a>;<br><br>   location / {<br>      proxy_pass <a href="http://$proxy_host">http://$proxy_host</a>;<br>      proxy_set_header X-Forwarded-Host $host;<br>      proxy_set_header X-Forwarded-Server $host;<br>      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>   }<br>}<br></div></div><br></blockquote></div><div><br></div><div>Аналог ProxyPassReverse - proxy_redirect:</div><a href="http://nginx.org/ru/docs/http/ngx_http_proxy_module.html#proxy_redirect">http://nginx.org/ru/docs/http/ngx_http_proxy_module.html#proxy_redirect</a><br><div>Но, возможно, правильнее не валить всё в одну кучу, а сделать несколько серверов.</div><div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><br>-- <br>Igor Sysoev<br>http://nginx.com</div></div></div>
</div>
<br></body></html>