Virtual Hosting in windows using Apache 2.4.4

Posted on Updated on

virtual-hosting file

Today i came across a situation where i had to do virtual hosting in windows with my application running in tomcat. After lots of try, i could come to a solution.

I had java application running in tomcat on port 8080. So the url was http://localhost:8080/myapplication. To host this application globally i needed to map this url to a global ip. Below are the steps how i achieved this:

1. Redirection of tomcat application is achievable using the Apache HTTP package. Firstly download the appropriate apache package from

2. Install apache from the downloaded package. It will be installed in C:/Program Files/Apache Software Foundation/

3. Go to C:/Program Files/Apache Software Foundation/Apache 2.4(any version you downloaded)/conf folder. There you will find httpd.conf file

4. Open httpd.conf file with your editor and at the end of the file add the following code:

<VirtualHost *:80>
ProxyPass /myApp http://localhost:8080/myApp/
ProxyPassReverse /myApp http://localhost:8080/myApp/

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


Note:  1. The VirtualHost tag may be commented with #, just uncomment it and add the above lines. If you dont find VirtualHost tag, simply copy the above code and paste it at the end of the httpd.conf file.

2. Here myApp refers to the application/project name. In all my posts i will be using myApp for application name.

Now my application runs on localhost instead of localhost:8080/myApp.

Thats all, You are done with virtual hosting.



One thought on “Virtual Hosting in windows using Apache 2.4.4

    […] After successful virtual hosting and redirecting my application, the redirection worked but the stylesheet(css) and images did not get loaded. For virtual hosting  check my post on Virtual Hosting in windows using Apache 2.4.4. […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s