views:

1576

answers:

2

Hello all. I've been developing locally on a little ubuntu netbook with xampp for about 7 months. Two weeks ago I got a computer I'd like to use as a server. I've installed the latest Ubuntu distribution and xampp, moved all my files over, and forwarded port 80. I've also got a domain name from dyndns.com which is being updated by a client which runs in my router (a Netgear WGR6154 v8).

Now, when I try to access my server by typing in the address I got from dyndns.com the browser loads until it timesout. I can access everything locally using localhost as the address so I believe xampp is running, just unable to connect with the internet.

In order to be able to view my files over the internet what should I do next?

Thanks to all in advance...

[I'm starting a bounty for the first person to help me get my files successfully online]

+1  A: 

You should make sure your xampp is not listening to only the localhost.

to do so edit your apache configuration file and check and search for Listen directive

you should be able to know also by analysing the output of netstat -a.

After that make sure your router is forwarding properly, using tcpdump would help.

drop me a comment if you need more help.

Cheers

RageZ
Listen is set to: Listen 80
danwoods
tcpdump returns: tcpdump: no suitable device found
danwoods
netstat -a output is here: http://pastebin.com/ma18ae0d
danwoods
just checked your netstat the server is listening on every ip so it's fine.... make sure your forwarding is ok. what is the output of your ifconfig ?
RageZ
Thanks for checking. I'm away from the server and going to bed but I'll report back in the morning...
danwoods
Thanks again. I really appreciate it...
danwoods
no problem! see tomorrow not sure if I am going to be there same time as you...
RageZ
output of ifconfig posted here: http://pastebin.com/m35895c8b
danwoods
Could line 16 from the netstat -a output show a problem? tcp 0 0 localhost:48560 localhost:www TIME_WAIT The "TIME_WAIT" is what I'm curious about...
danwoods
Finally working on the server again after a tree limb fell and took out my cable. Any other ideas?
danwoods
Current update: http://ubuntuforums.org/showthread.php?p=7991743#post7991743
danwoods
I still thinks you have a problem with your router nat settings
RageZ
+9  A: 

You have a combination of issues here, and that is something of a problem. Each issue is complex in an of itself. Here is what I would recommend to get you going for certain.

First verify that you can surf the web from your server. This will confirm that you have a working ethernet interface.

Step 1 make sure that XAMPP, and your files are viewable from your home network. I assume you are using something like 192.168.1.X for your network and perhaps your server is 192.168.1.10

Go to another computer in your house and type http://192.168.1.10/ and see if you can see your files. If you can then you know that the server is properly configured and XAMPP is working.

Then add an entry to your hosts file to resolve yourdnsrecord.com (or whatever your dyndns record is) to your private ip address. Then when you type yourdnsrecord.com into a browser from that computer you should still get your files. This will rule out your server being improperly configured to listen for that domain name.

Next you need to test to see if there is a firewall problem. To simplify this, first remove your home router from the equation. Instead, place your new server directly onto your internet connection. (assuming you can). This way, you do not need to have NAT or firewalls properly configured. Your dyndns name should map to a public IP and your server should then have that IP and be connected directly to the Internet. If you have your server directly connected, and the command ifconfig from the root prompt returns the same public IP address that your dynamic dns record is point to, then it should work.

It will make your life easier if you have an iphone or some other way to test how your network is seen from the Internet.

If your public IP as shown by ifconfig is different than the IP record in your dyndns account, then your dynamic dns update script is broken. manually set the IP, and see if things work.

It is very possible that this will not work. Some ISPs firewall port 80 preventing their subscribers from hosting servers. Once you have your server directly connected to the internet you can test this (even if your dns is not working) by using the public IP address. As root, type ifconfig from the command prompt to get your public ip address. Then type the command tcpdump -i eth? port 80 from the root prompt. eth? needs to be the same interface that you saw had a public IP address from the ifconfig command. usually this is eth0 but it might be wire0 or something like that.

This command will show you all traffic coming on port 80 to your server.

From an iphone (or whatever second Internet connection you have) browse to the IP address that you got from your ifconfig command. If you see something on your server (and it is directly connected to your ISP) then your ISP is not firewalling you.

If you can get to your server, when it is directly connected to the Internet, either by IP address or by DynDNS address, then your ISP is OK and it is time to debug your firewall.

Two things need to work for your firewall to be configured NAT, where the public address that your router gets from your ISP is converted into your private network and a firewall rule which permits that traffic. If you get this far, then you know your firewall is the problem and then it is just a matter of getting its configuration correct. There are far to many home routers to document here, but you usually can find how-to instructions for your router for this task from the manufacturers website (usually it is part of the manual)

If you follow these instructions exactly you will get your system working. Make comments on the process and I will be happy to modify this to make it clearer.

HTH, -FT

ftrotter
Wow, thanks ftrotter! I can't wait to try all these steps once I get home. I'll post results as I work through the steps. Thanks again...
danwoods
When trying to access http://192.168.1.* from a computer on the same network, the url changes to localhost/musicneverstopped/index.php which is the location of the file I'm trying to access, but the browser displays "Failed to Connect: Firefox can't establish a connection to the server at localhost."
danwoods
And here's the other thing, the only other computer in the house is also running xampp. When I turn xampp off (on the comptuer I'm trying to access the server with, the 'other' computer) I get the message above. If I start xampp on the 'other' computer and then type in the address of the server into it's browser, it pulls up it's own localhost page (which happens to be the same page, as I developed the site on the 'other' computer and then moved it to the server)
danwoods
Turned off NAT Filtering in my router. That seemed to help forward port 80, as canyouseeme.org was reporting it closed and now it's open...
danwoods
Although the situation in the above two comments is still there...
danwoods
Alright!!! It has something to do with folder permissions or something. When I edited index.html in /opt/lampp/htdocs I can see the changes when I enter the server address into the 'other' computer's browser, but I can't redirect outside of htdocs...
danwoods
Changed some re-directs and now I can access the server from the 'other' computer!!!
danwoods
You are getting there. The simplist way forward is to just move your content into htdocs. However, you can also change the default directory that XAMPP uses. In any case. if you can see your server from the "other" computer you can now start ensuring that you can get there from the internet.HTH
ftrotter