Apache2 ProxyPass到不同端口的NGinx API

时间:2015-02-02 13:58:15

标签: codeigniter mod-rewrite nginx apache2 mod-proxy

Apache2有一个运行的codeigniter应用程序。它需要进行API调用,该调用在不同的端口上运行Sinatra应用程序,并且正在使NGinx变形。

Apache2正在端口80上运行 Nginx正在端口81上运行。

对于类型为/auth/(.*)$的几个网址,我们应该将apache请求重定向到http://localhost:81/auth/ $ 1。

我尝试了ProxyPass / ProxyPassReverse以及RewriteRule,但我们总是将重定向或发送请求发送到/ login,这是我们点击“/”时的默认值

  RewriteCond %{REQUEST_URI} ^/auth.*$
  RewriteRule ^/auth/(.*)$ http://localhost:81/auth/$1

并使用ProxyPass

DocumentRoot       /srv/app/www
DirectoryIndex     index.php

ProxyPass ^/auth/(.*)$ http://localhost:81/auth/$1
ProxyPassReverse ^/auth/(.*)$ http://localhost:81/auth/$1

我甚至尝试过Redirect和RedirectPermanent。

理想情况下,端口80到/ auth的任何请求都应该在端口81 localhost:81 / auth / ...上命中nginx身份验证服务,然后返回结果。

0 个答案:

没有答案