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

4 thoughts on “How to redirect a port to a sub-domain – ProxyPass

  1. Hey, I just used your tut to get my subsonic subdomain going. Thank you. I just have one question the “Allow from all” directive in the proxy settings isn’t dangerous? I mean can others proxy through my server? Or the ProxyRequests on Off takes care of this?

    1. Hi Gerdez,

      Indeed, Allow from All will allow any IP to access to your subdomain. That will not put at risk your proxy settings as ProxyRequests is Off.
      Obviously, you can always improve the security of your service by authorizing only specific IPs like “Allow from” or a set of IPs, etc…

      Hope it helps!

  2. I’ve added the same config and also made the subdomain point to my IP . Still I’m unable to access deluge via subdomain. And by adding this i cannot access, which works if I remove the above configuration.

    What should I do?

  3. Hi,
    When you go on the, any error? Blank page? Not found? etc…

    Do you have proxy_html and proxy_http enabled?
    Have you restarted apache?

    For your virtualhost, what do you have? May be there is a conflict there?


Leave a Reply

Your email address will not be published. Required fields are marked *