Tomcat -> Apache2
I have Apache2 installed and serving up standard webpage and I have linked it to Tomcat6 running on the same server (OpenSuse 11.2). What I'd like to do is: When you type www.climacity.ch the users should be redirected to www.climacity.ch/Axis, instead it shows the default Tomcat page. The url in the address bar should remain www.climacity.ch. When I configure the Tomcat's server.xml, I get Internal Server Error. I googled a lot, but couldn't find the clue. Any ideas?
Here my configuration files: Apache (/etc/apache2/vhost.d/climacity.conf): JkWorkersFile /etc/tomcat6/workers.properties JkLogFile /var/log/tomcat6/mod_jk.log JkLogLevel error NameVirtualHost 195.176.237.119:80 <VirtualHost www.climacity.ch:80> ServerAdmin webmaster@climacity.ch ServerName climacity.ch Alias /Axis "/srv/tomcat6/webapps/Axis" <Directory "/srv/tomcat6/webapps/Axis"> Options Indexes FollowSymLinks allow from all </Directory> # The following line prohibits users from directly accessing WEB-INF <Location "/Axis/WEB-INF/"> deny from all </Location> ErrorLog /var/log/apache2/climacity_ch-error.log CustomLog /var/log/apache2/climacity.ch-access_log combined HostnameLookups Off UseCanonicalName Off ServerSignature On JkMount /Axis/* ajp13_01 </VirtualHost> <VirtualHost www.climacity.org:80> ServerAdmin webmaster@climacity.ch ServerName climacity.org RewriteEngine on RewriteCond %{HTTP_HOST} ^www.climacity.org$ RewriteRule ^ http.//www.climacity.org/Axis%{REQUEST_URI} [L,P] <Directory "/srv/tomcat6/webapps/Axis"> Options Indexes FollowSymLinks allow from all </Directory> <Location "/Axis/WEB-INF/"> deny from all </Location> ErrorLog /var/log/apache2/climacity_org-error.log CustomLog /var/log/apache2/climacity_org-access.log combined HostnameLookups Off UseCanonicalName Off ServerSignature On JkMount /Axis/* ajp13_02 </VirtualHost> Tomcat (/etc/tomcat6/workers.properties): ... worker.list=ajp12, ajp13_01, ajp13_02 worker.ajp13_01.port=8009 worker.ajp13_01.host=www.climacity.ch worker.ajp13_01.type=ajp13 worker.ajp13_02.port=8009 worker.ajp13_02.host=www.climacity.org worker.ajp13_02.type=ajp13 worker.ajp13_01.lbfactor=1 worker.ajp13_02.lbfactor=1 ... Tomcat (/etc/tomcat6/server.xml): ... <Host name="www.climacity.ch" appBase="/Axis" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> </Host> <Host name="www.climacity.org" appBase="/Axis" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> </Host> ... |
Hi and welcome to LQ
There are some errors in your configuration: You use different NameVirtualHost and VirtualHost notation. Those 2 should be the same, like: Code:
NameVirtualHost 195.176.237.119:80 Quote:
Quote:
Code:
RewriteRule ^ http.//www.climacity.ch/Axis%{REQUEST_URI} [L,P] |
When you type www.climacity.ch the users should be redirected to www.climacity.ch/Axis
Quote:
PS: I have two domains "www.climacity.ch" and "www.climacity.org", both point to our server. Here is my climacity.conf: JkWorkersFile /etc/tomcat6/workers.properties JkLogFile /var/log/tomcat6/mod_jk.log JkLogLevel error NameVirtualHost 195.176.237.119:80 <VirtualHost 195.176.237.119:80> ServerAdmin webmaster@climacity.ch ServerName climacity.ch ## DocumentRoot /srv/tomcat6/webapps/Axis <Directory "/srv/tomcat6/webapps/Axis"> Options Indexes FollowSymLinks allow from all </Directory> <Location "/Axis/WEB-INF/"> ## AllowOverride None deny from all </Location> ErrorLog /var/log/apache2/climacity_ch-error.log CustomLog /var/log/apache2/climacity.ch-access_log combined HostnameLookups Off UseCanonicalName Off ServerSignature On JkMount /Axis/* ajp13_01 </VirtualHost> <VirtualHost 195.176.237.119:80> ServerAdmin webmaster@climacity.ch ServerName climacity.org ## DocumentRoot /srv/tomcat6/webapps/Axis ##Alias / "/srv/tomcat6/webapps/Axis" ## RewriteEngine on ## RewriteCond %{HTTP_HOST} ^www.climacity.org$ ## RewriteRule ^ http.//www.climacity.org/Axis%{REQUEST_URI} [L,P] <Directory "/srv/tomcat6/webapps/Axis"> Options Indexes FollowSymLinks allow from all </Directory> # The following line prohibits users from directly accessing WEB-INF <Location "/Axis/WEB-INF/"> ## AllowOverride None deny from all </Location> ErrorLog /var/log/apache2/climacity_org-error.log CustomLog /var/log/apache2/climacity_org-access.log combined HostnameLookups Off UseCanonicalName Off ServerSignature On JkMount /Axis/* ajp13_02 </VirtualHost> |
Quote:
Code:
<VirtualHost 195.176.237.119:80> Quote:
Quote:
|
Now strange things happens: In my error logfile I can read:
File does not exist: /srv/tomcat6/webapps/Axis/factory.impl.gwt, referer: http://www.climacity.ch/A89E8DC0677F...B31.cache.html There is no file named "factory.impl.gwt", that's gwt stuff managing my jsp pages. The class is named "/srv/tomcat6/webapps/Axis/WEB-INF/classes/axis/web/gwt/server". |
How can I make that also the requests points to the subdirectories? In the access.log I can read:
Quote:
|
Hi,
I think that mod_rewrite is not suitable for your situation. What you can do is to setup the vhost www.climacity.ch as a reverse proxy to the tomcat server running your application and ditch mod_jk. So check if you have mod_proxy installed and use the following: Code:
<VirtualHost 195.176.237.119:80> Regardrs |
Hi,
Yes, I think mod_rewrite is not the right thing and reverse proxying neither. When I type in the address-bar www.climacity.ch it changes to www.climacity.ch/Axis/ instead of staying www.climacity.ch. Changing to www.climacity.ch/Axis/ makes some links faulty (our php pages are not threated by httpd, everything is forwarded to tomcat). May be the missconfiguration lays down in the server.xml file. I saw its log, the vhost www.climacity.ch is not responding so I uncommented it. I also saw, that nobody was listening on port 8443 (also uncommented). Actually my configuration files looks like this: /etc/apache2/vhosts.d/climacity.conf: Quote:
Quote:
Quote:
|
Quote:
Quote:
I guess you need to change the DocumentRoot to be /srv/tomcat6/webapps, if you app is deployed under /Axis, because with the rewrite the /Axis uri becomes actually /srv/tomcat6/webapps/Axis/Axis |
All times are GMT -5. The time now is 11:58 PM. |