VirtualHost with mod rewrite pointing at tomcat application
0
votes
2
answers
1680
views
I am setting up a server running on Ubuntu 14.04. I have apache and tomcat installed with the rewrite module for apache and mod_jk enabled. I have mod_jk properly configured so apache is forwarding the request to the app context correctly. I also have the domain name pointed correctly at the server and am able to browse to it. However, I am having issues with my virtual host file. I am attempting to point a domain at the application running within tomcat. Here is what I have currently as a virtual host file.
ServerName www.domain.com
DocumentRoot /var/www/domain
RewriteEngine On
RewriteRule \/$ /context [L]
I have tried many variations of this but have had no luck. Any help to resolve would be most appreciated.
** Update **
I am able to produce a rewrite to a directory named after the tomcat application, in this example
context
in my apache html folder (/var/www/html/context)
. Here is what my virtual host file now looks like :
ServerName www.domain.com
DocumentRoot /var/www/html/context/
Options FollowSymLinks
AllowOverride None
RewriteEngine On
RewriteRule \/$ /context [L]
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
The problem now is it is not rewriting to the tomcat application named context
. So to sum it all up :
http://{{ip_address}}/context
- works like it should and displays the tomcat application
http://domain.com
- redirects me to html content within /var/www/html/context
How can I force the rewrite rule to redirect to the tomcat application name context
? Is there a global setting that will override rewrites and instead of displaying content within apaches html directory to applications mounted with mod_jk?
Thanks in advance for your help.
Asked by Mike Croteau
(113 rep)
Jan 16, 2015, 03:43 AM
Last activity: Aug 13, 2016, 05:33 PM
Last activity: Aug 13, 2016, 05:33 PM