Reputation: 1133
I have a vServer with debian 7.8 (wheezy), apache2 webserver and tomcat7.
I deployed a webapp with the apache www.mydomain.com/manager
app into /var/lib/tomcat7/webapps/app/
which runs perfectly under www.mydomain.com:8080
. It gets linked to my webapp´s welcome page www.mydomain.com:8080/app/#welcome
.
My apache2 www.mydomain.com/host-manager
lists only “localhost” under host name.
Now I want to connect my apache2 webserver to tomcat7, so that www.mydomain.com
starts my webapp (like www.mydomain.com/#welcome
).
Things, i have done so far:
/etc/apache2/mods-enabled/proxy_http.load
my /etc/apache2/sites-enabled/000-default
file looks like
<VirtualHost *:80> ServerName www.mydomain.com ServerAlias mydomain.com ProxyRequest Off ProxyPreserveHost On <Proxy*> Order deny,allow Allow from all </Proxy> ProxyPass / http://localhost:8080/ ProxyPassReserve / http://localhost:8080/ DocumentRoot /var/lib/tomcat7/webapps/app/ </VirtualHost>
changed /etc/hosts
127.0.0.1 localhost
to 127.0.0.1 www.mydomain.com
my /etc/tomcat7/server.xml
looks like
<Server port=”8005” shutdown=”SHUTDOWN”> ... <Connector port=”8080” protocol=”HTTP/1.1” ... redirectPort=”8443” proxyPort=”80” proxyName=”www.mydomain.com” />
What am i missing?
Upvotes: 1
Views: 488
Reputation: 2759
From your configuration i noted:
<_Proxy *>
and </Proxy_>
DocumentRoot
in combination with proxy configuration, doesn't make senselocalhost:8080/app/
you have to configure this (see below)I have no tomcat7, but i configured nginx: apache (80) --> proxy --> nginx (8080)
With the following configuration a subdirectoy app
from nginx is displayed at port 80 via apache. I hope this will help to answer your question (just works fine with Debian 8):
/etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ProxyVia On
ProxyRequests Off
ProxyPreserveHost on
ProxyPass / http://127.0.0.1:8080/app/ retry=0
ProxyPassReverse / http://127.0.0.1:8080/app/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
enable proxy and restart apache:
a2enmod proxy
a2enmod proxy_http
service apache2 restart
all possible error messages are logged into /var/log/apache2/error.log
, you should also take a look at your tomcat logfiles.
If you put the configuration in an other file than 000-default.conf
you have to enable the site with a2ensite <sitename>
so that apache knows that it exists.
Upvotes: 2