Port Redirection in Windows

b4u

Golden Member
Nov 8, 2002
1,380
2
81
Hi,

I'm looking into a way of doing proper port redirection in windows.

What I have:

I have a router that will redirect all incoming port 80 to a specific IP. I will receive all kind of requests in port 80.

Example:
svn.mydomain.com:80 (subversion server)
www.mydomain.com:80 (webserver)

With this I'm trying to use port 80 for all connections, since I can remotely be behind a proxy that only allows http port 80 requests.

So now in my server, the router forwards all port 80 requests to the right computer ... then I need to configure the server, so that requests from "svn.mydomain.com" are instead forward to port "8080" and requests from "www.mydomain.com" are forward to port "8081" (for example).

So port 8080 will answer the SVN server, and port 8081 will answer a JBoss server.

What is the best way of doing it?

I thought maybe Apache Http Server? Can he do it? Or is there a simpler way?

I've never dealt with Apache Http Server before, so no experience on configuring it ...


Thanks
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
You are looking for a web server that supports Virtual Hosts. Both Apache and IIS support this.
 

b4u

Golden Member
Nov 8, 2002
1,380
2
81
Originally posted by: Crusty
You are looking for a web server that supports Virtual Hosts. Both Apache and IIS support this.

I've just installed Apache HTTP Server 2.2.11 (on machine with IP 192.168.1.1), and I'm trying to do the trick ... need some help here ...

What I want:
www.mydomain.com:80 -> (forwards to) 192.168.1.1:80 (has another web server, jboss)
svn.mydomain.com:80 -> (forwards to) 192.168.1.1:8123 (another port, has an svn server listening)


What should be my config on apache?

My router forwards all port 80 requests to my machine. My machine has:

- Apache HTTP Server on port 80
- JBoss on port 8080
- SVN Server on port 8443 (SSL)

(I payed for "mydomain.com" domain, and it's pointing correctly at my home/router)


Can I config this?:

Listen 80

<VirtualHost www.mydomain.com:80>
ServerName 192.168.1.1:8080
ServerAlias 192.168.1.1:8080
</VirtualHost>

<VirtualHost svn.mydomain.com:80>
ServerName 192.168.1.1:8443
ServerAlias 192.168.1.1:8443
</VirtualHost>


Is this the way?


Thanks
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Well you can have multiple VirtualHost directives with different ports in them(i.e. <VirtualHost *:80> and <VirtualHost *:443>). But you've got it backwards, you want the VirtualHost directives to have the IP:port and the ServerName directive to have the hostname.

Is the SVN portion part of Apache as well? Cause if not you won't be able to have Apache listen on 8443 with the SVN server on the same port.
 

b4u

Golden Member
Nov 8, 2002
1,380
2
81
Originally posted by: Nothinman
Well you can have multiple VirtualHost directives with different ports in them(i.e. <VirtualHost *:80> and <VirtualHost *:443>). But you've got it backwards, you want the VirtualHost directives to have the IP:port and the ServerName directive to have the hostname.

Is the SVN portion part of Apache as well? Cause if not you won't be able to have Apache listen on 8443 with the SVN server on the same port.


I believe it is, in this case I'm using VisualSVN, which installed an Apache service on my machine.