Skip to main content

How to redirect a port to a sub-domain – ProxyPass

Very often, you need to connect to a service through it’s dedicated port, for example, Subsonic, will be 4040 (http://mywebsite.tld:4040), Deluge torrent will be 8112 or could be changed to 9092, ….

But it could be complicated to remember all theses ports and if you are behind a proxy that block all the connection except HTTP and HTTPS (80 and 443), you actually may want to set up a subdomain to access your services. In my case, to access my Deluge torrent WebUI, I will prefer to go to without the need to enter the port number.

This could be easily achieve on your LAMP server by tweaking your virtualhost with the variables ProxyPass and ProxyPassReverse.


You will need to install the following packages in root:

And you will also need to activate the mod-proxy-http (Already installed)


Virtualhost configuration

Here is my full Virtualhost for Deluge that you could reuse:

(You need to keep the exact syntax. If for example you forget the / after http://localhost:9092, you will come up with a blank page when you will try to access to the subdomain)

The “/” of ProxyPass and ProxyPassReverse tells Apache that you want to reroute all the connection from the root folder of your Vhost to
You could aslo reroute the website to another folder for example.

Restart your apache server (in root)

And your good to go!

Before the Internet