Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a basic web server. I am running Ubuntu 12.04 desktop. I have installed LAMP and set up html files, and when I open a browser and navigate to (static internal IP of my server), or, the modified index.html file that came with Apache2 appears on screen. The problem is with connecting through internet, rather than intranet. I have used a cell phone (WiFi disabled) to connect through the cell network, as well as giving my external IP to a friend, and asking him to try to open the site. Each time, however, we receive error 502 Bad Gateway - Response Error, a bad response was received from another proxy server or the destination origin server.

Let me say that I have already gotten disabled the remote configuration option in my router, so that's not the problem, and I have already forwarded port 80 through my router. Yes, I'm pretty sure I did it right. In fact, to test that the router wasn't the problem, I connected my server directly to my modem, which does NOT have an internal router, and still got the same error. A Google search has told me that my ISP (CenturyLink) does not block port 80, and that others with the same ISP have been successful in hosting their own sites from home. Obviously I'm not very knowledgeable about this subject, but from my understanding, I've ruled out everything except the server, which means that something is either blocking port 80 on the way in, or the data is never making it back out. My question is this:

Is there something (firewall, etc.) in Ubuntu that could be responsible for such an error?

I have already enabled, disabled, and opened holes through UFW, and that hasn't made a difference. One tutorial I read suggested that AppArmor could be a problem, and they suggested that it be uninstalled, so I followed their instructions on how to do so, but I have noticed that there is still an AppArmor folder in /etc/, so I'm not exactly sure what all got done. If there is any other information you could give me, I would truly appreciate it. In the event that I overlooked some blatantly obvious solution, I'm really sorry to bother you all, but it hasn't been for lack of effort; I've been working on this for the vast majority of the past two days...

Also, I'm not sure if it makes any difference, or if this is actually related, but I'm having the same problem with SSH; I can SSH into this system over my local network using username@local_IP, but I can't get it to work over a non-local network (yes, I do realize that I need more than just a local IP) Maybe this helps narrow down the problem, then again, maybe not...

Thanks in advance for your time and support!!!

share|improve this question
up vote 0 down vote accepted

Once you can connect to HTTP/SSH from the local network, the rest is totally beyond control of your Ubuntu machine - it is most definitely either a mis-configuration of the router, your ISP blocking ports, you trying the wrong external IP address or something else.

The 502 error suggests that your requests go through some kind of a proxy, which also may complicate the matter. If you can't access the server, you should be getting a connection timeout, not a response from some proxy.

share|improve this answer
Hm. Ok, I will have to keep working on that then. Thanks for your answer. – Casey Hungler Aug 23 '12 at 3:28
Ok, just to confirm this, I blocked access to port 80 in UFW, and was unable to connect from intranet or internet. Thanks so much for your explanation, I never would have thought about it that way. – Casey Hungler Aug 23 '12 at 11:33

Your Answer


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.