Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
How to use DNS to redirect domain to specific port on my server

My web application is running on myserver.mydomain:10000 I would like to make it available on the intranet as mywebapp.mydomain.

Reading Forward port to another Ip/port, I have looked into rinetd, but I don't fully understand how I can achieve my goal:

  1. create a cname alias mywebapp --> myserver on the name server
  2. run rinetd on myserver, redirecting port 80 to 10000 ?!?

That would redirect all http traffic.

I seem to have a gap in my understanding. Can anyone help me ?

share|improve this question

marked as duplicate by Chris S Sep 14 '12 at 1:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
What O.S. are you running? –  Massimo Nov 16 '09 at 10:48
    
Ubuntu 9.04 and FreeBSD 7.2, 64bit versions. –  ssc Nov 16 '09 at 22:57
    
did you ever find a way to do this with rinetd? –  fschwiet Jan 10 '12 at 4:17
    
never tried rinetd as things worked fine using a reverse proxy on apache as shown in the answer below. –  ssc Jan 16 '12 at 2:46
add comment

3 Answers

up vote 7 down vote accepted

If you don't want to create another IP, then all you can do is install a reverse http proxy on the main IP and a name based virtual host to route the traffic using mod_proxy.

Here is how you can do it with apache, almost any http server can do it, other popular alternatives are squid, nginx, lighthttpd, etc.


    Listen IP_ADDR:80
    NameVirtualHost IP_ADDR:80

    <VirtualHost IP_ADDR:80>
      ServerName  yourname.yourdomain

      ProxyPass        / http://localhost:10000/
      ProxyPassReverse / http://localhost:10000/

    </VirtualHost>

share|improve this answer
    
GREAT! That solves my problem, thank you very much! Tried it out right away, works like a charm. :-) –  ssc Nov 16 '09 at 23:04
add comment

DNS only maps hostnames to IP addresses, it knows nothing and can't do anything about ports.

A solution to your need could be using a NAT router/firewall to forward you'r public IP's port 80 to the internal server IP's port 10000.

share|improve this answer
    
Thanks for your reply! :-) There's no public IP involved, everything happens within the intranet, one single network, no routing whatsoever. Moreover, NAT would redirect all HTTP traffic, I only want to redirect mywebapp.mydomain:80 to myserver:mydomain:8080 and mywebapp does not exist as a logical host, but only as a cname (or so) –  ssc Nov 16 '09 at 9:20
1  
You should consider using the reverse proxy functionality of your webserver. –  Antoine Benkemoun Nov 16 '09 at 9:25
    
If you're in an intranet, IP space can't be at a premium, so just allocate more IPs. –  womble Nov 16 '09 at 9:37
    
You're right, I have as many IP addresses as I could possibly need. Would you care to elaborate how that helps me ? –  ssc Nov 16 '09 at 22:57
add comment

I assume you're wanting just one site redirected as such, and you run other sites on port 80 already? If so, and you are not using HTTPS (SSL), then you can either set up Apache to handle this domain as mentioned, or you can teach Apache to do the forward itself, to port 10000.

I know know what server OS or http server you are using though... so can't help more.

share|improve this answer
add comment

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