Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i did the webserver on my laptop (IIS7, vista), it running on port 81, i'm using dns service of everydns.com to point mydomain.com to my webserver, everything was fine, my friends can access my website throw url http://mydomain.com:81, but i can not (i access website on the same machine which running webserver), web browser always say unable to connect. What happened?

share|improve this question

migrated from serverfault.com Nov 6 '09 at 11:10

This question came from our site for professional system and network administrators.

6 Answers 6

It's possible that your router is denying loopback connections. Since other people can connect to the specified host at port 81, it's possible that when you try to connect, the connection gets translated to the outside on the router then the router refuses to translate it back into the internal network (for your home server).

If this is the case, the suggestions to add to the hosts file would work around this issue, but they're not addressing the core problem.

You might check the advanced network settings (or firewall settings) on your router configuration and make sure loopback connections aren't being blocked.

share|improve this answer

quick and dirty resolution is to add an entry to your hosts file.

share|improve this answer
    
No so dirty at all, in my opinion! –  Arjan Nov 6 '09 at 11:33

This is almost certainly because your router is getting in the way - your request to your webserver is going to your external IP address and so far as the router is concerned this is odd so needs to be blocked (not sure why, it may be security, it may be something else) but the key point is that from your machine and from within your network the IP address is that of your internal network not that on the public network.

To fix this you need to tell your machine that the IP address for http//mydomain.com is local, two ways to do this: 1) Add an entry to your hosts file 2) If you have a local DNS server (probably unlikely if you're running the server on your laptop) and configure that to point mydomain.com to your laptop's IP address instead of going to retrieve the value from the internet.

If this doesn't cover it we're going to need to know a bit more about the layout of your network.

I'll add that this is, sort of, a developer question as the reason I had to work this out in the first instance was to support some internal dev support stuff that needed to be exposed to external access...

share|improve this answer

You can probably access your site via http://localhost:81 or http://127.0.0.1:81

share|improve this answer
3  
If anything, this should read localhost:81 –  jhwist Nov 5 '09 at 12:44
    
if the application is configured to a specific domain, this might break its functionality –  iAn Nov 5 '09 at 14:08

When you're testing locally, are you sure the URL is specified properly? Internet Explorer will give a less-than-useful error if you don't specify the URL properly. Specifically,

http://mydomain:81

will work whereas

mydomain:81

Will not. Many users have grown accustomed to entering the domain name without the preceding http:// because normally the browser will add that, but if a port number is specified, IE will not automatically add the http://.

share|improve this answer
    
It will even change localhost into local on many machines. Funny people @Microsoft. –  Arjan Nov 6 '09 at 11:35

To futher the existing answers:

The vast majority of SOHO routers (so basically anything suppied free with your connection, or you bought for less then ~ £200 / $250) isn't going to cope too well at all with a DNS entry resolving back to their external IP address.

If you just type in http://mydomain.com (i.e. hitting the default port 80), you will probably get your router's homepage. Thus, when you are trying to view on port 81, your requests are trying to come from the router on port 81, which (as you would suspect) has nothing running to serve these requests, so breaks.

Edit your hosts file (c:\Windows\System32\drivers\etc\hosts - you will need to run Notepad as Admistrator if you have UAC enabled), and drop in a new line

127.0.0.1    mydomain.com

After you save, flush your dns cache by runing "ipconfig /flushdns" in a command shell

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.