Apache Mod_proxy to forward http traffic to Java App server 8080

Reading Time: < 1 minute

In my vps server I wanted to forward http port 80 to glassfish 8080 ports without having glassfish config changed. So I assume httpd apache server is installed. So

cd /etc/httpd/conf

nano httpd.conf

Add the below lines and save and restart apache

<VirtualHost *:80>
# Your domain name
ServerName Domain_NAME_HERE

ProxyPreserveHost On


ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

# The location of the HTML files, and access control information
DocumentRoot /var/www
<Directory /var/www>
Options -Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Result

apacheforward

Source: https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Administration_and_Configuration_Guide/Install_the_Mod_proxy_HTTP_Connector_Into_Apache_HTTPD.html