Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to make my home server accessible to the whole web. I have installed Nginx on my Fedora 15 64-bit Linux machine, and it works with localhost but it doesn't work online or allow other computers on the network to access it via the IP address. It keeps coming back with:

Could not connect

I have port forwarding. I have even tried different ports but they all seem to be blocked. What could be wrong? I have a netgear router.

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-    prohibited 

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-    prohibited 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
share|improve this question
1  
In broad strokes, you need to get your home firewall/router to allow incoming connections on http (i.e. port 80) and you need it to send traffic it receives on port 80 on to your home server. Specifically, how to do that is highly dependent upon the brand and model of your home router. –  golliher Aug 6 '11 at 12:17
    
What model Netgear router EXACTLY? –  KCotreau Aug 6 '11 at 14:22
    
Its a N600 Wireless Dual Band Router, Model WNDR3400, and my web server is Nginx 0.8.54 –  Qasim Aug 6 '11 at 14:24
    
Can you access it from your internal network from another computer using the IP address? How are you determining your external IP address? Do you have a static IP or DDNS? –  KCotreau Aug 6 '11 at 14:25
1  
There has to be some kind of firewall on your Linux box that is blocking you. At first, I thought it was a general how-to question, but now we have a specific, and frankly, I am not qualified to answer it. I would ask another question, like "My Fedora 15 Linux machine seems to be blocking port 80. How do I configure this to allow port 80 access from other computers?" After that, you can try to move on, and maybe come back to this question. –  KCotreau Aug 6 '11 at 14:45

4 Answers 4

Fedora's default firewall configuration blocks port 80. The easiest way to unblock it is using the system-config-firewall tool, provided in default Fedora installations.

To use it in a graphical environment, locate the Firewall option in your desktop's application menu (it's usually in the Administration category) or run system-config-firewall via a terminal or by pressing ALT+F2. Then check the checkbox next to WWW (HTTP) 80/tcp:

system-config-firewall with WWW highlighted

If you need HTTPS/SSL, also select Secure WWW (HTTPS) 443/tcp. Finally, click Apply to make the changes take effect.

To use it from a console, run system-config-firewall-tui. Press the TAB key until Customize is highlighted and press Enter. Press the Down Arrow until you arrive at WWW (HTTPD) and press Enter to select it:

system-config-firewall-tui with WWW highlighted

(Don't forget HTTPS if you need that too.) Now select Close, and then OK to save your new firewall configuration.

share|improve this answer

Please add the output of iptables -L from the machine running nginx to your question.

As in the comments above, it sounds like your Linux server is blocking port 80 from non-local connections.

Also, have you set nginx to listen on all interfaces, not just 127.0.0.1? It'll be in the nginx config file (like listen 80; or similar).

share|improve this answer
    
How do I set it to listen on all interfaces? I have it as listen 80; –  Qasim Aug 6 '11 at 14:53
    
Output:pastebin.com/mFr1rsAC –  Qasim Aug 6 '11 at 14:53
    
listen 80; server_name _; –  Qasim Aug 6 '11 at 14:56
  1. Verify that the different device can access your server (ping).
  2. Verify that the different device can access another service on your server (ssh).
  3. Verify that you do not have a local firewall on your server (iptables -L).
  4. Verify that your web server is listening on the interface 172.16.0.15 or on * (netstat -al).
  5. Verify that your web server allow the client to connect in its configuration file.
  6. From your different device, do a telnet 172.16.0.15 80 to see if you have a connection timeout, a connection refused or a connection close (1st case would be a firewall, 2nd would be your web server is not listening or down, 3rd would be a web server configuration issue).
share|improve this answer
    
Sorry I am really new to this and I dont really understand most of the points you asked me to verify –  Qasim Aug 6 '11 at 15:36
    
#1 im not sure how to do it, same with #2, Here is what I get from #3:pastebin.com/mFr1rsAC, #4 it is listening indeed on 172.16.0.5, #5 here is my config file (im pretty sure its allowing):pastebin.com/hTcSvcMH, #6 It says this: connect to address 172.16.0.15: No route to host –  Qasim Aug 6 '11 at 15:47
    
The result from #6 is suspect. You should have about the same result from #1 doing ping 172.16.0.5. Basically, the device from where you try to access your server does not know how to access the server. How are your client and server connected ? What is the ip address of the client ? –  jfgagne Aug 6 '11 at 16:00
    
So far all I have done is this: Accessed my router settings, added port forwarding (port 80 HTTP, TCP, 172.16.0.15). When I ping from my netbook to 172.16.0.15, it just send Received * from * in *ms, doesnt stop doing that (loops or something). –  Qasim Aug 6 '11 at 16:11
    
What is the ip address of your server: 172.16.0.5 or 172.16.0.15 ? You seam to have tried the telnet with 172.16.0.15, but if the server is 172.16.0.5, you should try telnet 172.16.0.5 80. For me, the 2 results from you netbook doing ping <server ip address> and telnet <server ip address> 80 are incoherent: you cannot receive reply to ping and a 'No route to host' from telnet on the same ip address at the same time. –  jfgagne Aug 6 '11 at 16:29

Try localtunnel. Similar services, at some cost, include showoff.io and Pagekite.

share|improve this answer

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.