Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 09-08-2008, 09:09 PM   #1
LQ Newbie
Registered: Sep 2008
Posts: 2

Rep: Reputation: 0
simple forwarding based on hostname/port


I'm in the situation where I have a bunch of different domain names pointing at one ip. I do some web development, and am trying to host some test sites on a single machine of mine. There I have say 3 domains,,,, all pointing to some IP.

What I want to do is have the requests forwarded to different ports on the same machine, maybe one is static html in apache, one is a tomcat server, etc.

Therefore, I need to be able to say something like: -> localhost:2222 -> localhost:2223 -> localhost:3333 -> localhost:4445


Googling around I've found so many techniques that seem way too complex. iptables, ipmasquerading, a bunch of others...

Could anyone suggest a simple way to do this, preferably involving little more configuration than what I supplied above? (I don't mind if I have to change the syntax a little :P).

Kallin Nagelberg
Old 09-08-2008, 11:20 PM   #2
Mr. C.
Senior Member
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Firewall port forwarding knows nothing about hostnames. Use hostname-based redirect rules in apache to redirect as you desire.
Old 09-09-2008, 12:28 AM   #3
LQ Newbie
Registered: Aug 2008
Posts: 11

Rep: Reputation: 0
Sounds like you might try name based virtual hosts in apache;

plus the examples page has just that;

Good luck
Old 09-09-2008, 01:47 PM   #4
LQ Newbie
Registered: Sep 2008
Posts: 2

Original Poster
Rep: Reputation: 0
So it sounds like apache is definitely the best tool for this job. Thanks


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
simple port forwarding SPEEDEX Linux - Networking 1 09-28-2007 11:20 AM
Domain-based Port Forwarding? cparker15 Linux - Networking 5 05-27-2007 01:59 PM
Packet based port forwarding serge Linux - Networking 10 05-07-2007 07:37 AM
Simple Port Forwarding Firewall - not forwarding MadTurki Linux - Security 14 04-09-2006 12:08 PM
Port Forwarding Based on the Source linuxboy69 Linux - Networking 2 01-06-2004 04:44 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:52 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration