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.

set up: Windows Server 2008 R2, running IIS and DNS service.

I'm developing a website with web2py on this server. Web2py comes with its own server. The site is currently only accessible browsing from the server itself using the address 127.0.0.1:8000/[directory_name]. I'm trying to make this website available to the intranet too.

Is there a way to set up sub domain to point to this IP + port? I want to set it up like this

app1.domain.com ----> would open 127.0.0.1:8000/app1

app2.domain.com ----> would open 127.0.0.1:8000/app2

and so on? Or if there other better approach please let me know. Thanks!

share|improve this question
add comment

2 Answers

You could define the mapping from the domains in your hosts file (which will direct traffic from the local machine to the local machine). You then need to configure Web2py to deliver content based on the different hostnames used in the requests. This answer to a different question outlines your options.

To make this available to other hosts on your network, you need to put the mappings in a DNS server available to your network.

You won't be able to map the apps to a port through your host files or DNS - that would have to be in the links. Since you are running IIS already, you can't use the default ports, unless you add another IP address to the server, and have web2py listen on that address instead.

Web2py will handle requests for anything that arrives on an address/port it is listening on. You then need to configure web2py to serve different content depending on what fqdn was used in the request (host headers), or have a web app running on top of web2py handle the difference. With the information you have given I can't give much more help than that.

share|improve this answer
    
Thanks dunxd. I'm sorry I'm quite new to this. So it looks like web2py is able to run on port 80 too. I tried disabling IIS and have it run on 127.0.0.1:80 and I was able to access it using domain.com from every computer in the LAN. However there are some other websites running under IIS too so I can't set it up this way. I tried running web2py on 127.0.0.2:80 and point a Host A sub domain to it. However I can only access this sub domain on the server itself but not from LAN. –  J Penguin Feb 8 '11 at 10:14
    
Ok - in that case, you will need to keep the port numbers in your URLs so that the requests are sent to the correct ports. You cannot define ports in DNS - just IP addresses. –  dunxd Feb 8 '11 at 12:40
    
See my edit which goes a little further in answering your question. –  dunxd Feb 8 '11 at 12:46
add comment

If you are using IIS7 on your 2008R2 machine, you can use the URL Rewrite module:

http://www.iis.net/downloads/microsoft/url-rewrite

You can then configure domain:port/path combinations that redirect to another domain:port/path combination.

I use this to achieve something similar to what you want for my SubSonic music server. Assuming that IIS7 on my server is hosting mydomain.net, I wanted to map http://mydomain.net/music/subsonic/<xxx> to http://localhost:8080/<xxx>

If you setup the subdomains in IIS, you can then use rewrite rules that are based on regular expressions at the server level to catch requests to, e.g. map app1.domain.com to would open 127.0.0.1:8000/app1

share|improve this answer
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.