2017-04-16 86 views
0

我试图重定向到另一个端口的请求定义时ProxyPassMatch不能有一个路径,但我得到这个错误:重定向到另一个端口获得的ProxyPass |在一个位置

ProxyPass|ProxyPassMatch can not have a path when defined in a location. 

这是我的虚拟主机重定向:

<VirtualHost *:80> 
     ServerName sub.domain.com.br 
     DocumentRoot /var/www/html/xxx 
     ServerAlias www.sub.domain.com.br 
     Options -Indexes 

     ProxyRequests On 
     ProxyPreserveHost On 

     <Proxy *> 
      Order deny,allow 
      Allow from all 
     </Proxy> 

     <Location /> 
       ProxyPass /route/ www.sub.domain.com.br:31311/ 
       ProxyPassReverse /route/ www.sub.domain.com.br:31311/ 
     </Location> 

     ErrorLog ${APACHE_LOG_DIR}/bot_error.log 
     CustomLog ${APACHE_LOG_DIR}/bot_access.log combined 


</VirtualHost> 

回答

0

ProxyPassProxyPassReverse子句嵌套<location>部分必须有第一参数删去。这也是有道理的 - 被代理的“伪位置”必须在<location XXX>级别上定义。

因此,以您的示例配置。考虑做这样的改变:

<VirtualHost *:80> 
    ServerName sub.domain.com.br 
    DocumentRoot /var/www/html/xxx 
    ServerAlias www.sub.domain.com.br 
    Options -Indexes 

    ProxyRequests On 
    ProxyPreserveHost On 

    <Proxy *> 
     Order deny,allow 
     Allow from all 
    </Proxy> 

    <Location /route/>         # <== 
     ProxyPass www.sub.domain.com.br:31311/   # <== 
     ProxyPassReverse www.sub.domain.com.br:31311/ # <== 
    </Location> 

    ErrorLog ${APACHE_LOG_DIR}/bot_error.log 
    CustomLog ${APACHE_LOG_DIR}/bot_access.log combined 
</VirtualHost>