Apache-基于主机名的ReverseProxy

时间:2019-06-18 16:25:37

标签: linux apache reverse-proxy centos7 mod-proxy

我正在尝试在Apache 2.2中设置反向代理。

我有两个域“ rui.com ”和“ example.com ”分别指向我的VPS( 10.0.0.1 )和想要反向代理这样做:

rui.com -> 10.0.0.1:5000/软件

example.com -> 10.0.0.1:5003/example

我尝试过的事情:

<VirtualHost *:443>                            
 ServerName rui.com
 ProxyPass / http://localhost:5000/software
</VirtualHost> 

<VirtualHost *:443>                            
 ServerName example.com
 ProxyPass / http://localhost:5003/example
</VirtualHost> 

尝试99999:

<Proxy "*">
  Require host rui.com
  ProxyPreserveHost On

  ProxyPass / http://localhost:5000/software
  ProxyPassReverse / http://localhost:5000/software
  ProxyPassReverseCookiePath "/" "/"
</Proxy>

<Proxy "*">
  Require host example.com
  ProxyPreserveHost On

  ProxyPass / http://localhost:5003/example
  ProxyPassReverse / http://localhost:5003/example
  ProxyPassReverseCookiePath "/" "/"
</Proxy>

提前谢谢!

0 个答案:

没有答案