Viewing Site Problem

Discussion in 'Installation/Configuration' started by entertheraptor, Dec 13, 2010.

  1. entertheraptor

    entertheraptor New Member

    Hi all, I'm new to the neighborhood and and have stacks of questions but I'll attack them one at a time.

    Where do I start? I recently set up a home based web server following the Perfect Server - Ubuntu 10.10 [ISPConfig 3] guide here on HowtoForge and found the guide very helpful and easy to follow (considering my limited knowledge of Linux and web server administration) and the server is working fine. There are just a couple of minor issues...

    Firstly, I created a client and a site for that client and then pointed the domain name for that site to my server by editing the A records for the domain name at my domain registrar and everything works fine. If someone enters that domain name into their browser address bar then they arrive at the site on my server. I however cannot view the site using a computer that is on the same network and behind the same router as the server.

    When I try to go to the domain name my browser attempts to log into my router (Netcomm NB7) which is the same effect I get if I enter the modem/routers network IP or the WAN IP.

    So I attempt to access the server by typing 192.168.x.x/mydomain.com/web and I get a 403 Forbidden error. I can get around this by editing my domains vhost file and commenting out the settings in the first section of the file, eg.

    <Directory /var/www/mydomain.com>
    # AllowOverride None
    # Order Deny,Allow
    # Deny from all
    </Directory>

    However this also allows access to the /web1 directory as well as /web and I'm not sure that it's a good idea on a live server either.

    I'm working on a way to access my server and sites on it from within my home but outside my home network at the moment but in the mean time does anyone have any suggestions about how best to deal with this issue? I imagine that it's a common one.

    Thanks in advance.
     
  2. snowweb

    snowweb New Member

    This is most likely because of your router not supporting "Reverse NAT" or "loopback" which I think is the same thing.

    See http://www.pcwintech.com/test-for-reverse-nat

    Probably the best solution for this is to add into your host file on each PC on your local network, the local IP address of the server ie:

    mynewserver.com 192.168.0.5

    You will then be able to view the server from machines inside and outside your network.
     
    Last edited: Dec 13, 2010
  3. entertheraptor

    entertheraptor New Member

    Thanks for the reply snoweb,

    As far as I can tell, no my router doesn't support reverse NAT.

    So where do I find this "host" file on a Windows XP machine? Are you saying that after this file is edited that I will be able to access the server locally using the domain name?
     
  4. snowweb

    snowweb New Member

    On Windows after a standard install, it is located at

    c:\Windows\System32\Drivers\etc\

    It's name is 'hosts' note that it has NO file extension. You may also need to enable the showing of all files including hidden ones and system files, in order to see it.

    Because it has no file extension, it will ask you what program you want to use to ope it with, when you double click it. Choose notepad.

    After editing it, be sure that you didn't accidentally rename it 'hosts.txt'!

    It is possible that the file has been 'protected' by some security software you have installed on your machine. If so, you will have to resolve that else where.

    After you have edited this file correctly and saved it, you should immediately be able to access your website from that computer by typing the domain name into the address bar.
     
  5. entertheraptor

    entertheraptor New Member

    Thanks again but it didn't work.

    I edited the "hosts" file then entered the domain name into the browser and after a few seconds got the message that the site couldn't be found. That's ok I figured because it's a different behavior so we're getting somewhere, I just have to figure why it's not finding the site. Then I remembered (duh) that my server listens on port 81 and not port 80 (to avoid conflicts with other devices on the network) so I added ":81" to the end of the IP address in the hosts file.

    Instantly the browser went back to trying to log into the router, go figure?

    So I'm still stuck with the same problem, did I miss something?
     
  6. snowweb

    snowweb New Member

    You can't enter the port number in the hosts file. What you can do is whenever you specify your website domain, just add :81 at after the domain name, like this:

    www.mydomain.com:81

    You said that you chose port 81 to avoid conflicts with other devices on your network, but this is unnecessary, since having separate IP addresses will avoid conflicts. You only need to use another port if the server has something else using port 80 on it already.

    If the server already has port 80 in use, the common solution would be to move the other program or site using port 80 to another port (like 8080) so that port 80 remains free for you webserver.
     
  7. entertheraptor

    entertheraptor New Member

    Great work snowweb, appending :81 to the domain name in the browser did the trick. (seems kind of obvious now) Thanks for your help on that one.

    All I can tell you about device conflicts is when I tried to forward port 80 from my router to the server I got a message from the router saying "the DSL routers port 80 is already in use" and it insisted on forwarding inbound http requests to port 8080 (which is the port that ISPConfig works on). I'm only guessing this has something to do with an apache server that is running (and has been for a long time now) on one of my Windows machines. I thought that conflicts would be avoided simply because the machines have different IP's too but apparently my Netcomm NB7 thinks differently. Anyway I got around the Netcomm's problem with port 80 and insistence on port 8080 by forwarding to port 81. If there is a better way of doing things then I'm all ears.

    Now that I can access the site on my server from a machine on the same network I have another question for you.

    I intend on using Wordpress to power a site or two on my server. The experience I have had with working with Wordpress on local machines in the past tells me that if you access the Wordpress site from anything other than the address (or location) for the site that was entered into the Wordpress settings that the site will not display properly. For example if the sites address is "localhost" in the wordpress settings and then you try to access that wordpress site from another computer by using the network IP of the computer/server that Wordpress is installed on then the Wordpress site will not display properly.

    I know if I install Wordpress on my server and tell Wordpress that it's address is "mydomain.com" then it will display fine to people accessing the site from the outside world. What I'm asking is will appending the :81 to the domain name stuff things up for me trying to view the site from another machine on the same network or will the appended :81 be ignored?

    Might seem like a dumb question but if you don't ask then you don't know.

    Cheers and thanks again.
     
  8. snowweb

    snowweb New Member

    Great that you got it working.

    This problem arises because Wordpress uses URL rewriting and for this, it needs to know the root URL.

    I strongly suspect that you will have problems with that and possibly other problems not yet anticipated. My recommendation is that you concentrate on figuring out why you can't use port 80 and resolve that. Try to shift whatever is on it to another port.

    You said that you got the following error message from your ROUTER:

    This would seem to indicate that the port is occupied by your router and not by something running on your server. The other possibility is that you already have a port forward set up for port 80 from your router and that is why you got that message?

    Regardless, according to the error message, the problem is on the router. Check what port you access the router's home page for config? Maybe that is on Port 80? Maybe there is an option to move it to an alternative port. If it's not that, then it's some kind of port forward or 'service redirect' in the router config. If you still can't find it, try doing a 'hard reset' on the router and setting it up again from scratch, so there are no legacy settings in there.

    Hope this helps.

    Hope this helps.
     
  9. entertheraptor

    entertheraptor New Member

    You're right on the money, the routers home/config pages are accessed through port 80 and there appears to be no way to change this.

    So I guess the only solution is a different modem/router, one that will allow me to use port 80 for the web server. Got any suggestions?
     
  10. snowweb

    snowweb New Member

    Hmm.. I thought as much. That's a shame. 65,000+ ports to choose from and they have to put it on one of the two or three that you might want to use!

    Most routers don't do that. I'm using a Linksys here, because I like to use a custom firmware from dd-wrt.com but most routers these days are suitable. It might be worth checking by reading the review first, to make sure that it's capable of 'reverse NAT' or loopback.

    Good luck.
     
  11. entertheraptor

    entertheraptor New Member

    Thanks again for all your help and advice snowweb, I'll have to spend some time researching as it appears that reverse NAT isn't a commonly supported feature. If anyone wants to recommended a particular make and model it would be appreciated.

    Anyhoo thanks again, now on to my next question but I'll post a new thread for that one.
     
  12. snowweb

    snowweb New Member

    Probably if you get a router which supports the DD-WRT custom firmwares, it will do it anyway, but if it doesn't, you can then install the DD-WRT firmware and then it will certainly be capable of all you need plus lots more.

    You can check the DD-WRT website for supported routers at http://www.dd-wrt.com/wiki/index.php/Supported_Devices if you are interested.

    Don't forget - 2 things you need: Port 80 available and 'Reverse NAT' (or loopback).
     

Share This Page