开发者

Local IIS, how do I map a URL with a port number?

I'm runnning IIS 7 on my local dev machine. My website is up and running. To access the website, I need to enter the url with the port number in the browser's address ba开发者_运维百科r (www.ScoobyDoo.dev:91). What do I need to change so I only need to enter the www.ScoobyDoo.dev portion of the url? I've done this before but I'm drawing a blank. Port 80 is hosting a different website so I can't just move this one to the default http port.

Thanks!


If you want multiple sites to reside on the same IP address then you need to use HTTP Host Headers.

Provided that your existing website doesn't use SSL then you can use host headers. To configure host headers in IIS7 you modify the "Bindings" (there's a menu item for this in the right hand side Actions pane for the site):

Local IIS, how do I map a URL with a port number?

You want to add/edit your bindings for each site that resides on the same IP address, for example for your scoobydoo.dev site:

Local IIS, how do I map a URL with a port number?

The caveat here is that if you have users already browsing your first site by IP address then they will need to be redirected to the site using its domain name.

You can do this by adding a site bound to the raw IP address and creating a HTTP Redirect.


I'm not sure what you're expecting to do here. If something else is binding to port 80, and your web server is binding to port 91, then you'll need to specify port 91 in the web browser when making a request to the server. By default, without being explicitly given a port in the address, a web browser will make the request on port 80 (or 443 for SSL).

You might be able to add an entry to your hosts file (c:\windows\system32\drivers\etc\hosts) where you map the non-specified port version to the specified port version, but I don't think it'll work. That file is for DNS resolution, not port mapping. Worth a try though, I suppose.

Can you clarify a bit on what exactly you're expecting? Or what you think you may have done before? I wonder if you're not giving us the whole picture here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜