Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am running an apache2 server in ubuntu. When I connect my laptop directly to my modem, I can access my web page (from any computer or phone) without any problems.
I start getting weird issues when I try running my web server behind my DLink 524 router. It will run perfectly for about an hour or so then the web page will become inaccessible from any computer except the one which I am running my server on. I have made sure to forward and requests to port 80 on my machine and I have also set the router firewall to allow access through port 80 and port 443. I don't get any error messages in my apache2 log when my site goes down.
Since the site worked perfectly when my computer was connected directly to my modem, I figure it has to be a router problem. Anyone have any suggestions as to what the problem might be?
It will run perfectly for about an hour or so then the web page will become inaccessible from any computer except the one which I am running my server on.
Is it also inaccessible if you try to access it using the LAN IP address (obviously from another computer on the same LAN)?
The reason I'm asking is that sounds kind of like the behavior one might get from a tool like fail2ban, but I've never heard of one being put in front of a web server.
Also, if you reboot just the router, does the problem go away for another hour or so? And does the router have any logging capability?
I have 3 computers on my LAN (including the one with my server on it). Usually when it goes down none of the computers on my LAN have access to it; it went down this morning however, and one of the computers on my LAN was able to access it...weird.
I haven't tried to rebooting the router, I do reload the server ("sudo /etc/init.d/apache2 reload") and it will work again perfectly (for a certain amount of time). The router does have basic logging.
That's not true, he can host with a dynamic IP no problem if he needs to. There's detailed instructions on my site. But that's beside the point.
What 123linux321 was asking about your LAN IP is this: when it's down by hostname, can you still access it by pointing to the LOCAL ip of your server? (192.168.1.xxx or 192.168.0.xxx, etc.)
Additionally, if you leave it up connected only to the modem, does it continue to work indefinitely? (not cutting out after an hour or so?) I know that it's a pain to take your entire network off the internet for that long, you can skip this for now, and we'll see if we can resolve it without this step.
I haven't tried to rebooting the router, I do reload the server ("sudo /etc/init.d/apache2 reload") and it will work again perfectly (for a certain amount of time).
You've said that you don't get any error messages in your apache2 logs when the site goes down, but do the attempts leave any messages at all? In theory, access_log should contain a record of the attempt if Apache sees it.
I do not have a static ip address, and yes I am forwarding all my requests to and from port 80.
If I connect my server directly to my modem it works indefinitely; I had it running for 5 days straight without any issues before I disconnected it.
The attempts to connect to my server do not leave any messages.
I have increased the timeout time, and the max amount of keepalive requests and am currently waiting to see if this improved anything - maybe this would help at times if I have a poor wireless connection?
It's been running without any issues since 9 this morning; if it goes down again then I will try to access it on my LAN via its local address and see what happens...so far so good though.
so it just went down again, none of my computers were able to access it via my modem's ip address. One of the computers was able to access it via its local ip address however the others were not.
I included my apache2 configuration files in the attached text file - maybe something is wrong over there?
The files included are apache2.conf,ports.conf,envars, and 000-default which is the only file in the sites-enabled folder. The httpd.conf file is blank. Everything in the conf.d folder are the default settings, I haven't changed them.
Thanks everyone.
Last edited by 123Linux321; 05-02-2011 at 01:47 PM.
I do not have a static ip address, and yes I am forwarding all my requests to and from port 80.
I think the question was does the server have a static IP address on the LAN. In other words, is it possible that at some point there is a DHCP renewal that results in a new IP address for the server and therefore, port forwarding is pointing to the wrong IP address. And could you explain by what you mean by forwarding "from" port 80? On all of the routers I've ever used, you only forward to a port.
Quote:
Originally Posted by 123Linux321
If I connect my server directly to my modem it works indefinitely; I had it running for 5 days straight without any issues before I disconnected it.
As long as you're not messing with the apache configuration, I think this really points towards the router not being able to handle things. I really think that to narrow this down, you're going to have to test things one at a time. I'd set the server up and when it goes down next, reboot just the router and do nothing else. Also, could you borrow a different router from someone? If the same thing happens with two routers, then it is likely the server, but if a different router solves the problem, well, then we know you've got a bum router.
Quote:
Originally Posted by 123Linux32
The attempts to connect to my server do not leave any messages.
Which means either the packets are no longer getting to the server, or Apache is no longer listening. Next time it goes down, maybe take a look at see if Apache is still active and listening. netstat -pane | grep LISTEN should give you an idea. However, based on the fact that this only happens when the router is present, I'm still thinking that is the main "item of interest".
Quote:
Originally Posted by 123Linux321
I included my apache2 configuration files in the attached text file - maybe something is wrong over there?
Nothing jumps out at me. Maybe someone else sees something.
And could you explain by what you mean by forwarding "from" port 80? On all of the routers I've ever used, you only forward to a port.
Actually, it's both. The router forwards calls received on port 80 from the Big Wide World to port 80 on the designated computer.
If the server is DHCP on the local network, its local IP on the local network is subject to change with every reboot, depending on the other devices on the network and the DHCP configuration in the router.
Since the OP's computer receives the network calls when it's connected directly to the modem, which will pass through port calls, but not when the router is introduced into the mix, I think the solution lies with the router.
Actually, it's both. The router forwards calls received on port 80 from the Big Wide World to port 80 on the designated computer.
I'm probably being obtuse about what I mean. Absolutely, the router has to forward calls on port 80 to the designated server. What I was wondering about was if somehow 123linux321 was restricting the response to that call. The response is almost certainly going to be on some random high port, so if 123linux321 has somehow restricted the outgoing ports, that might explain some of the problem.
Quote:
Originally Posted by frankbell
Since the OP's computer receives the network calls when it's connected directly to the modem, which will pass through port calls, but not when the router is introduced into the mix, I think the solution lies with the router.
Unfortunately this is a slight oversimplification. When the server is connected to the router, it works for a bit, then stops. Since this never happens when the server is directly connected to the modem, I agree, this seems to suggest the router is somehow getting borked, but we need some more info before we can send a SEAL team in to take it out.
I just noticed some weird behaviour, and I don't know if it's related. If I turn off the apache2 server and enter my ip address in my browser, I still get directed to my site. Would anyone know why this is happening. If I enter http://localhost then it WON'T take me to my site (which would be the expected result).
I edited the configuration so that it won't even listen to any requests from my IP address but my site still comes up if I enter my IP address into my browser.
Thanks, Hangdog42. I have to work on my reading comprehension.
OP, could this new behavior be from the browser's cache? Try another browser, preferably one you haven't used to look at the site before. If you usually use Firefox, try the native Gnome browser, Epiphany.
I used epiphany and didn't get that same behaviour, thanks. As for the problems with my server I am going to assume it is a router problem. I'm going to try and get my hands on a new one soon and hopefully I won't have any more problems. Thanks everyone.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.