How to return content from an application running on a specific port in apache
14 Mar 2010Continuing on from the previous post where I explain how to show content from a different root folder depending on the sub domain e.g. http://foo.example.com will actually return content from http://example.com/foo (without changing the URL). Today I will extend this idea to show content from a separate service running on a different port within the same server. So in this case a call to http://foo.example.com returns http://example.com:port.
As in the previous post, we assume that you already have your sub domain DNS settings correctly configured and the subdomain now points to the IP address of your server, you should do the following in Apache running on an Ubuntu server.
Open the configuration file for your site. In this example, we will use the default site.
Add the following additional VirtualHost configuration to the end of the file (change the port number on localhost if you need to, of course!)
Now restart apache and your all done!