Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am learning Apache2, and I just attempted to make my local web server live to the internet.

When I type my IP 86.207.14.136 on the browser's address bar and access it, I see the index.html stored in /var/www. And that's exactly what is supposed to happen.

Problem is, when I try to access it from an anonymous web proxy such as webproxy.ca or any other, I can't see my webpage.

Can anyone please tell if I'm doing something wrong?

My IP address is 186.207.14.136/

traceroute 200.228.244.6 output:
traceroute to 200.228.244.6 (200.228.244.6), 30 hops max, 60 byte packets
 1  192.168.0.1 (192.168.0.1)  3.123 ms  4.779 ms  5.353 ms
 2  10.14.0.1 (10.14.0.1)  13.232 ms  17.436 ms  17.788 ms
 3  bb160001.virtua.com.br (187.22.0.1)  18.179 ms * *
share|improve this question
    
You have to "tell" your router which device to send outside traffic too. Right now your accessing your IP externally, but your router doesn't know WHICH computer on your network it should be connecting you to. You need to open the port on your router and forward it to the local IP of your server. –  MaxMackie Nov 25 '12 at 20:28
    
Hi, thanks for commenting. I already did that. I went into 'Virtual Server' settings and fowarded the 80 Port to my computer. Before I did that, I couldnt access my apache by typing my ip, but now I can. But Iam not having success when I try to access it from other computers. –  user1091856 Nov 25 '12 at 20:32
    
Connecting to 186.207.14.136:80... failed: Connection timed out. –  jippie Nov 25 '12 at 20:33
1  
From my IP address I can't come past: ` 13 bb160006.virtua.com.br (187.22.0.6) 376.304 ms 375.065 ms 375.200 ms`, which is an IP that belongs to your provider. But I am unsure how many hops are left to your IP address. Some providers block port 80 in their corporate firewall, did you check their policy? –  jippie Nov 25 '12 at 20:38
    
Can you add the output to traceroute 200.228.244.6 to your question? That is about where I loose track of the hops: i.stack.imgur.com/MAcJ0.png –  jippie Nov 25 '12 at 20:57

3 Answers 3

Did you open the port on your firewall?

share|improve this answer
1  
How can I check that? Doesn't the port become open when I make Apache listen to it? Can you please confirm if you see anything when you access 186.207.14.136 ? –  user1091856 Nov 25 '12 at 20:25
    
You have to explicitly do that, Apache won't do it for you (which is a good thing security-wise). I cannot connect to your webserver, so you probably still don't have port forwarding in place. –  jippie Nov 25 '12 at 20:33

First off you need to open the port in your firewall or router.

If you're on a home network, and are behind a router, you'll need to portforward. This site can help you figure out your router's configuration for port forwarding. For web pages, forward TCP 80 to the system behind the router.
If you later encounter issues with your web server not transmitting data or something, try adding in a rule for UDP 80 to the portforwarding/firewall

If your connection is directly to the internet, and not behind a router, or you've already port-forwarded and it's still not working, start by checking the configuration of your firewall. You can do this easily by doing sudo iptables -L -v. (Pastebin the result and comment here if you want me to read through it). If there's a default "DROP" policy, or there's no reference of "ACCEPT" anywhere in the output, i can help you with that if you include the results of said command I just gave you.

share|improve this answer
    
Good answer, but why udp/80? –  jippie Nov 25 '12 at 20:45
    
The HTTP protocol also uses UDP in rare cases. for accurate operation for certain actions (i don't know the RFC for HTTP offhand, but i know for a fact it references UDP), UDP should usually be opened on port 80. –  Thomas W. Nov 25 '12 at 20:48
    
Not saying it is untrue, but I never heard it before, also my Apache certainly isn't listening on port udp/80. –  jippie Nov 25 '12 at 20:52
    
Then its irrelevant, although i've read the RFC. I'll remove it, but add it as a footnote saying "If stuff breaks, try adding in a UDP 80 rule." –  Thomas W. Nov 25 '12 at 21:03
    
Hello, thank you for answering. Sorry for not making it clear, I'm actually behind a router. I already went into the my router web-based settings, and did what the tutorial told me to. Still can't access apache from other computers. –  user1091856 Nov 25 '12 at 21:18

What type of router do you have?

Have you added a NAT rule to say that all traffic coming to port 80 on your public IP address should be directed to the computer running the Apache web server on your network?

share|improve this answer
    
Hi. Thank you for answering. My wireless router is a D-Link DI-524. What I've done is this: I started apache2, made it listen to port 80, then went into my router settings page, Virtual Server settings then enabled port fowarding to the computer where apache is running. After I did this, I was able to access my webpage by typing my ip address on the browser (which wasnt possible before csetting virtual server). Problem: computers outside the LAN can't access it. –  user1091856 Nov 26 '12 at 3:00
    
I would suggest that you call your ISP and have them test this with you. From what I've read, you are able to access your Apache server from behind your router using the routers public IP address. It's very important that this is the public IP address because that means that your router seems to be correctly configured. I will also assume that you've been able to access the Apache server from a different computer than the one running the Apache server. This is also important because it means that the firewall on the Apache server is correctly configured. [to be continued] –  StFS Nov 26 '12 at 13:20
    
[continued] This really only leaves the ISP routing and as jippie pointed out above, they seem to have you on a private IP subnet (10.14.0.1) which means that they are doing NAT (to map 186.207.14.136 -> 10.14.0.1) but you then also want to do NAT (to map 10.14.0.1 -> 192.168.x.x, the IP of your Apache server). This sounds like a can of worms. Call them and ask them to try to access your Apache server through both the public IP (186.207.14.136) and the private IP (10.14.0.1). As I said, there doesn't seem to be a problem with your config so it really must be the ISP. –  StFS Nov 26 '12 at 13:26
    
There is one thing you could possibly try though. Instead of using your routers Virtual Server setting, try using NAT. I would even suggest that you try using a non-standard port for the public port (something above 1024) but you point it to port 80 on your server. See support.dlink.com/emulators/di524/help_adv.html for instructions, the section "Special Applications". Just make sure you delete your existing Virtual Server settings first. –  StFS Nov 26 '12 at 13:34

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.