Two web servers behind an ADSL router

I wanted to see how easy (or hard) installing Mahara (mahara.org) could be so I decided to create a second web server on my openSUSE 11.1 machine at home. Since I already have things in the first server (port 80) that I’m testing, I decided now would be a good time to see how easy (or hard) it might be to create another web server on a different port.

So, I checked the doco and thought one of the examples seemed OK. So here’s what I added to my httpd.conf.local:

Listen 8080

NameVirtualHost 192.168.1.1:8080

<VirtualHost 192.168.1.1:8080>
   ServerName www.marc.local
   DocumentRoot /srv/www/htdocs-8080
</VirtualHost>

<Directory /srv/www/htdocs-8080>
Order Deny,Allow
Allow from all
</Directory>

After discovering that my router was still forwarding 8080 to 192.168.1.111 (to a VMware server I had going a few years back to finish a uni project) I was then able to access the port 8080 web site using my external IP address from the Terminal Server at work, but when I try to load http://192.168.1.1:8080 or http://my.external.ip:8080 or even http://localhost:8080 using Firefox on the openSUSE box itself, it kinda starts loading and the browser just sits there with that spinning animation meaning it’s not getting anywhere.

Obviously, being such a beginner at these things, I’ve done something wrong, but I don’t know what. I should probably read more doco, but there’s just so much of it, I’m sure I’ll go crazy and smash something before getting anywhere.

Does anybody care to point out my mistake? :slight_smile: Is being behind a home ADSL router with no real external name (www.marc.local) the cause of my problem? How do you publish two web sites on two different ports using just IP addressing?

Thanks.

Actually, accessing :8080 locally is showing the contents of /srv/www/htdocs, and not /srv/www/htdocs-8080, and it’s not just sitting there with a spinning animation getting nowhere, it’s definitely serving up the port 80 web site when I’m accessing port 8080. I must have done something else before to get it to hang like that.

Everybody seems to think it’s the <Virtuahost> line that names the virtualhost. It is not, it is in fact the line:

ServerName www.marc.local

and any ServerAlias lines. As long as you use any of the ServerNames or ServerAlias in the URL, your request will go there. In fact you didn’t even need to bother with port 8080, it could have worked only port 80

So if you add this to the config:

ServerAlias mahara

then add to /etc/hosts

127.0.0.1 blahblah mahara

in other words add mahara to the list of names that map to 127.0.0.1, and then point your browser to:

http://mahara

you should get the virtualhost. Ah you also need to change that line to

NameVirtualHost *