: 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
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.
More posts by @Frith620
1 Comments
Sorted by latest first Latest Oldest Best
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.