Whenever i configure a new server i usually end up searching for this problem. How to redirect apache to tomcat ? There are various solutions out there but for now i am going to talk to about the easy one. Here are the steps :
Assumption : It is assumed that you have ssh access to your server and JDK, Tomcat and apache have been successfully installed.
Step 1 : Enable module proxy
ubuntu@ip-172-31-23-106:~$ sudo a2enmod proxy Enabling module proxy. To activate the new configuration, you need to run: service apache2 restart
Step 2 : Enable module proxy_http
ubuntu@ip-172-31-23-106:~$ sudo a2enmod proxy_http Considering dependency proxy for proxy_http: Module proxy already enabled Enabling module proxy_http. To activate the new configuration, you need to run: service apache2 restart
Step 3 : Restart apache
ubuntu@ip-172-31-23-106:~$ sudo service apache2 restart * Restarting web server apache2
Step 4 : Edit VirtualHost
ubuntu@ip-172-31-23-106:~$ cd /etc/apache2/ ubuntu@ip-172-31-23-106:/etc/apache2~$ sudo vi sites-enabled/000-default.conf
Step 5 : Add Proxy entry inside VirtualHost tag
ServerName YOURSERVERNAMEGOESHERE ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/
Step 6 : Save file and restart apache
Now if you try to access your website on port 80 it won’t show you apache page but it will show you tomcat default page.
Recent Comments