Reputation: 4661
I have a web app hosted by tomcat that I can see on localhost:8080/my-webapp/
. I would like to redirect it to localhost
with apache, but am unable to do so.
Here is my configuration file for apache:
LoadModule proxy_module modules/mod_proxy.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule proxy_html_module modules/mod_proxy_html.so
<VirtualHost localhost:80>
ProxyPass / http://localhost:8080/my-webapp/
ProxyPassReverse / http://localhost:8080/my-webapp/
</VirtualHost>
Apache works, but when I go to localhost
I am getting the default "it works" html file (not my web app) - I restarted apache multiple times.
Is there a standard way to do the redirection?
Note: I am using Apache 2.2.22 on Debian.
EDIT: tail -f /var/log/apache/error.log
after I restart Apache:
[Thu Oct 09 09:52:33 2014] [warn] module proxy_module is already loaded, skipping
[Thu Oct 09 09:52:33 2014] [warn] module deflate_module is already loaded, skipping
[Thu Oct 09 09:52:33 2014] [warn] module proxy_html_module is already loaded, skipping
[Thu Oct 09 09:52:33 2014] [notice] Apache/2.2.22 (Debian) mod_jk/1.2.37 proxy_html/3.0.1 configured -- resuming normal operations
Upvotes: 0
Views: 1943
Reputation: 2653
Referring to the comments: First scrap the first three lines. Then try the following:
<VirtualHost localhost:80>
ServerName localhost
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:8080/my-webapp/
ProxyPassReverse / http://localhost:8080/my-webapp/
LogLevel debug
CustomLog /var/log/apache/localhost.proxy.access.log combined
ErrorLog /var/log/apache/localhost.proxy.error.log
</VirtualHost>
Then check the config using apache2ctl -t
and reload apache if everything's fine.
In case apache still serves the default web site, use apache2ctl -S
to see a list of all loaded VirtualHosts. Also, append the contents of the newly created localhost.proxy.error/access.log in the post.
Upvotes: 1