Mobile app version of vmapp.org
Login or Join
Frith620

: Assign subdomains to separate ports on web server I have set up an Abyss web server as a little experiment, and I want to know if it is possible to assign subdomains to different ports on

@Frith620

Posted in: #LocalSeo #Subdomain #Virtualhost #Webserver

I have set up an Abyss web server as a little experiment, and I want to know if it is possible to assign subdomains to different ports on the machine the web server is running on.

I have a couple web UIs that I'd like to assign subdomains:


192.168.1.1:8000 becomes example.com/webui1/
192.168.1.1:8001 becomes example.com/webui2/


The webUIs are available by accessing their ports via example.com:8000.

I have tried using a reverse proxy, but it seems that this is only usable on one internal IP at a time.

What other options do I have?

Answer is good, but my current set up doesn't meet the requirements. Abyss Web Server X2 is required to use Virtual Hosts with Abyss.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Frith620

1 Comments

Sorted by latest first Latest Oldest Best

 

@Phylliss660

You need to make a separate VirtualHost for each port, like so:
#assuming you have this in your config
NameVirtualHost *:8000
NameVirtualHost *:8001
NameVirtualHost *:8002
NameVirtualHost *:8003 # (...)
Listen 8000
Listen 8001
Listen 8002
Listen 8003 # (...)


Then each VirtualHost looks like this:

<VirtualHost *:8000>
ServerName localhost
DocumentRoot /path/to/www/dir/1
</VirtualHost>
<VirtualHost *:8001>
ServerName localhost
DocumentRoot /path/to/www/dir/2
</VirtualHost>
<VirtualHost *:8002>
ServerName localhost
DocumentRoot /path/to/www/dir/3
</VirtualHost>
<VirtualHost *:8003>
ServerName localhost
DocumentRoot /path/to/www/dir/4
</VirtualHost>


And for each of the /path/to/www/dir/(1,2,3,4...) directories, you can use PHP for example, to redirect the user:

<?php
header('Location: example.com/webui2'); ?>


Or instead use mod_rewrite to do that within the Apache configuration.

But this setup is incredibly inefficient, a hassle to maintain, and not worth probably what you're intending to do.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme