I installed Apache2 and Tomcat7 on Ubuntu14
http://mysite.it/ -> Apache OK
http://mysite.it/phpmyadmin -> Apache OK, showing phpmyadmin
http://mysite.it:8080/myApp/ -> Tomcat OK, showing my Spring App
The 8080 port is closed in the Client intranet, and he would like to use http://mysite.it/myApp/. I need to setup the proxy/reverse proxy in Apache2
Here there is what I did:
aptitude update
aptitude -y upgrade
aptitude install -y build-essential
aptitude install -y libapache2-mod-proxy-html libxml2-dev
a2enmod proxy
a2enmod proxy_http
a2enmod proxy_ajp
a2enmod rewrite
a2enmod deflate
a2enmod headers
a2enmod proxy_balancer
a2enmod proxy_connect
a2enmod proxy_html
a2enmod xml2enc
Now I should modify /etc/apache2/sites-enabled/000-default.conf
The current (default) version is
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I tried to add also this snippet, but no luck
<VirtualHost *:*>
ProxyPreserveHost On
ProxyPass /myApp/ http://mysite.it:8080/
ProxyPassReverse /myApp/ http://mysite.it:8080/
ServerName mysite.it
</VirtualHost>
Can anyone help me? Riccardo
***** SOLUTION ****** Just one virtualHost:
<VirtualHost *:*>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPreserveHost On
ProxyPass /myApp/ http://mysite.it:8080/myApp/
ProxyPassReverse /myApp/ http://mysite.it:8080/myApp/
ServerName mysite.it
</VirtualHost>
http://mysite.it:8080/myApp/
in the proxyreverse instead of onlyhttp://mysite.it:8080/
? Also I dont know if you already know this... but it is necessary to restart the apache when you chacne the config - fmodosVirtualHost
entries conflict with each other. You need to merge them or you need to set differentServerName
s. See httpd.apache.org/docs/2.2/vhosts/examples.html - Aaron Digulla