Let's say I have the following configuration:
<VirtualHost domain.com> # Server names, admins, logs etc... ProxyVia On ProxyRequests Off <Location "/"> ProxyPass http://localhost:8080/tomcat-webapp/ ProxyPassReverse http://localhost:8080/tomcat-webapp/ Order allow,deny Allow from all </Location> </VirtualHost>
Now, I want the address domain.com/forum
to display content of my MyBB forum, which has its files inside the /var/www/forum
directory. How to accomplish this?
The "ProxyPass" and "ProxyPassReverse" parameters are used to tell Apache how to proxy requests. They require the "mod_proxy.so" and "mod_proxy_http.so" Apache modules, which are loaded by default in RHEL5 and RHEL6, but check the following lines are uncommented in the "/etc/httpd/conf/httpd. conf" file to make sure.
ProxyPass is the main proxy configuration directive. In this case, it specifies that everything under the root URL ( / ) should be mapped to the backend server at the given address.
Actually, I resolved this problem with the following code:
ProxyPass /forum ! ProxyPass / http://localhost:8080/tomcat-webapp/ ProxyPassReverse / http://localhost:8080/tomcat-webapp/ Alias /forum /var/www/forum
What it is recommending is using mod_rewrite to perform the ProxyPass instead of ProxyPass/ProxyPassReverse command.
Try something like:
RewriteRule ^/forum - [L] RewriteRule ^/(.*) http://localhost:8080/tomcat-webapp/$1 [P,L] ProxyPassReverse / http://localhost:8080/tomcat-webapp/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With