Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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:

  1. 192.168.1.1:8000 becomes example.com/webui1/
  2. 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.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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: http://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.

share|improve this answer
    
I see, as I'm using the free Abyss X1 web server I don't think Virtual Hosts is available to me. Unless I'm missing something extremely obvious. –  Michael Frank Oct 1 '12 at 7:29
    
@MichaelFrank - Well, you would simply upgrade to the version 2, which does support VirtualHosts (aprelium.com/abyssws/articles/x2-hosts.html) or install Apache instead. With your current setup, it is impossible. –  ionFish Oct 1 '12 at 7:36
    
As it's a small home project I don't really want to pay for an upgrade. I have tried installing Apache, but I'm having issue getting it set up on my WHS 2011. –  Michael Frank Oct 1 '12 at 8:17
    
Okay, I have got Apache set up and running but I don't see how I can point the DocumentRoot to the webUI of a running program. –  Michael Frank Oct 2 '12 at 23:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.