我试图将请求重定向到另一个端口,但我收到此错误:
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 :(得分:0)
嵌套在ProxyPass
部分中的ProxyPassReverse
和<location>
子句必须省略第一个参数。这也有一定道理 - 代理&#34;伪位置&#34;必须在<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>