View Full Version : Home Web Server
Mike1
February 14th, 2007, 01:26 AM
I've been on CyberTechHelp before, and you guys haven't let me down, so maybe you can help me with this.
For a school project I decided to make my own home web server. I have an old Compaq, Pentium 1 running at 166 MHz, 136 MB RAM. I network installed Debian 3.1 on it, installed Apache 2. No problems so far. After some work, I got FTP running and uploaded some files to my web server. Still no problems.
My network setup is as follows:
D-Link DI-604 Rev. E (I believe) router. Hooked up to a cable internet connection (Cogeco) with a dynamic IP. I have my main computer, my Xbox 360 and my home web server connected to it. When I type 192.168.0.102 (private IP of the web server) into my web browser on my main computer, I can see my webpage. Problem is, the outside world can't see my webpage when they type in my external IP.
So I do some Googling, the solution is port forwarding. I looked up how to set that up on my router, and configured it with no problems. As far as I can tell, the router is telling me that any requests from the web on port 80 on my external IP will be redirected to 192.168.0.102. I also looked in the Apache configuration file on my web server and made sure it was listening on port 80.
So I do yet more Googling, and apparently some ISPs block port 80. I told my server to listen on port 81 as well, and set up port forwarding on my router for port 81. Still no luck. I've been using several different online port scanners as well as my friends to see if they can access my webpage from my external IP but it doesn't work.
Any ideas? Thanks for any help.
Edit: Forgot to mention that I set up static DHCP on my router for the MAC address of my web server so that it always gets the private IP 192.168.0.102 I can post screenshots of my router configuration if need be.
leroys1000
February 14th, 2007, 03:46 AM
You can see that IP locally(lucky)across the network but
outside isn't going to see it because it is a local IP inside your
network.
If port fowarding is set properly to direct to that computer,
then you need to use the IP of your modem to connect from
the internet.
You need to run it from a computer outside your network,
or you may land on your router login.
Mike1
February 14th, 2007, 11:27 PM
I know I can FTP to the web server across my home network too (that's how I got my web page onto the server). I forwarded port 21 for FTP to the web server's private IP too and tested to see if I could connected externally. No luck there either. The problem must be with my router. I've been wanting to buy a new one anyway for wireless since I'm getting a laptop soon. What do you guys think?
Edit: Hmmm, I used canyouseeme.org to scan ports.. sometimes I get connection refused and sometimes I get connection timed out. Not sure what the difference is..
leroys1000
February 15th, 2007, 01:58 AM
Try again.
You need to use the modems IP to access the server from
outside the network.
The servers private IP is not accessable from outside.
Port forwarding forwards requests from the modem to the server
if configured properly.
Mike1
February 15th, 2007, 02:54 AM
I have been using the modem's IP that the router web interface gives me. It's 24.x.x.x something or other. Don't remember the other numbers.
Seamaiden
February 15th, 2007, 03:30 AM
Two questions from hubby (network engineer):
Can the static DHCP go straight static? My husband suggests making a DHCP range for the other machines on the network, then assign a static to the server that is outside that range. For instance, other machines get 192.168.1.0-100, and the server gets 192.168.1.200 - this is just a suggestion.
Next question; Do you have the Apache server listening on the LAN interface (whatever the IP is)? He thinks that's set in httpd.conf - don't quote us on it!
Your server is much like our home server: It's an old Compaq, Ubuntu Server running Apache.
Mike1
February 15th, 2007, 04:00 AM
I've set a static private IP for the web server outside the normal range of my other machines as you suggested. That alone didn't seem to help. As far as Apache configuration files, when setting up the web server I found two: apache2.conf and ports.conf
apache2.conf has a line in it that reads "Include /etc/apache2/ports.conf"
ports.conf contains only the line "Listen 80"
I know you can also specify an IP and a port such as "Listen 192.168.0.200:80" Is this what I should be doing? Should I specify my external IP? If so, I would have to change it any time I received a new IP address from my ISP.
Thanks for everyone's help so far.
z1p
February 15th, 2007, 04:09 AM
You shouldn't have to set apache up to listen on a specific IP.
Have you tried to access your webserver from your LAN using your external IP address?
Have you tried using a high number port instead of 80 or 81?
Mike1
February 15th, 2007, 04:34 AM
I have tried both of those things, used port 15000 for the second one.
z1p
February 15th, 2007, 05:01 AM
So you set up a virtual server on the dlink with a public port of 15000 and a private port of 80 (or what ever apache is set up to listen on) and set the private IP to the IP address of your PC.
Try going here (http://www.pcflank.com/scanner1.htm) and run the standard scan for just port 15000. But before that got to your router and set it to log dropped packets (Status tab, Log Button, then log settings.)
After the scan if your router is blocking the port still you should get an entry in the log.
Mike1
February 15th, 2007, 11:49 PM
I set the router to log dropped packets as you said. I tried scanning port 15000 and the standard port 80 with several different online port scanners including the one you suggested. The router log shows no sign of dropping packets destined for those ports.
I'm assuming this means that port forwarding is correctly configured on the router. If the problem does not lie there, is this a question of server configuration instead?
Edit: I found where the log file is located on my web server and decided to take a look at it. There are only three entries, and two don't surprise me. The first two are when the server starts and shuts down. The third reads something like "[error] [client 192.168.0.100] File does not exist". 192.168.0.100 is the private IP of my main computer that I routinely try to access the web server with, but I can't seem to find what triggers such a log entry. I'm wondering if it has any relevance to my problem.
z1p
February 16th, 2007, 09:33 PM
ok. so its looks like either a web server config problem or the port forwarding is misconfigured and forwarding it to the wrong place.
Can you access the server from your network using the 192 IP?
Can you access the server from your network using your public IP?
Mike1
February 17th, 2007, 06:32 PM
Yes, I can access the server from the 192 IP from inside my network, but I can't access the server from inside my network using the public IP.
Here is a screen of my port forwarding configuration:
http://i161.photobucket.com/albums/t221/mikazo/virtual-servers.gif
I've also tried entries such as public port 15000 and private port 80 but they didn't work either.
z1p
February 19th, 2007, 02:44 PM
Its hard to say if it is completely correct. Check your private IP address. I'd disable the 1st 2 servers and change the last to keep the public port of 15000, but set the private port to 80. Then make sure the apache server is set to port 80.
I was able to do basically the samething with my dlink router and it worked. (the dlink seems to run more or less the same firmware as yours)
Mike1
February 20th, 2007, 04:40 AM
I decided to restore my router to factory default settings and re-configure it. It worked. What the heck?! I can now access my web server from my external IP address. It wasn't even a "Eureka!" moment on my part.. more of a "Hmmm maybe I'll give this a try." Very unsatisfying. Oh well, at least it works now. Thanks for the help everyone.