Problem: I believe I've done everything required to deploy my app, but when I go to my new URL, I get a "problem loading page, server took too long to respond" error from the browser.


  • I'm deploying through EC2 for the first time.
  • I've got an instance running with Ubuntu 12.04, with an elastic IP associated
  • RVM is installed; I'm running Ruby 1.9.3-p194 and Rails 3.2.6
  • I went through the Passenger installer, installed the apache packages as instructed, and edited conf files.
  • I also bought a domain name from namecheap.com, and listed my EC2 elastic IP with them as the host.
  • My app is in /var/www (for example, my 'app' folder is at /var/www/app, and so on)
  • Dunno if this is relevant, but I used git to pull my app onto the server.

EDIT: Thanks to commenters, I was able to narrow down the problem: it is something to do with security on my EC2 instance -- requests are never reaching Apache2.

My security group is one I made myself (not "default"), and has three rules, all under TCP: 1) allow SSH access on port 22; 2) allow HTTP access on port 80; 3) allow HTTPS access on port 443. Allowed IPs are for all.

Do I maybe need more rules? SSH works fine.

Here's the result of a port scan:

    $ nmap -P0 -p80 ec2-xx-xx-x-xxx.compute-1.amazonaws.com
    Starting Nmap 5.21 ( http://nmap.org ) at 2012-07-16 18:16 UTC
    Nmap scan report for ec2-xx-xx-x-xxx.compute-1.amazonaws.com (yy.yy.yyy.yyy)
    Host is up.
    rDNS record for yy.yy.yyy.yyy: ip-yy.yy.yyy.yyy.ec2.internal
    80/tcp filtered http

    Nmap done: 1 IP address (1 host up) scanned in 2.05 seconds


    $ sudo ufw status
    Status: inactive

Again, thanks for any help.

  • Do you get anything at all in your apache logs? – Jenny D Jul 16 '12 at 12:31
  • the error log noted my stops and restarts; that is all. access.log and other_vhosts_access.log are empty. – Becky Russoniello Jul 16 '12 at 12:39
  • Do you have port 80 open in the EC2 security group the server is on? – ceejayoz Jul 16 '12 at 14:06
  • 1
    If you get nothing at all in your apache logs, that means the requests aren't even reaching Apache. @ceejayoz asked about the EC2 security group. It's also possible that you have a firewall running on your system and it blocks access to port 80. Have you tried connecting from your EC2 server or just with a browser on another server? – Jenny D Jul 16 '12 at 14:15
  • It could be that Apache isn't binding to the correct IP. Make sure it's binding to *:80 or <ip>:80. Also, you may want to change your ssh port to something other than 22 (just make sure you test it while you still have at least one other session left open). – sss Jul 16 '12 at 18:25

From the comments and your due-diligence, it would seem that you have done everything right. The fact that your server isn't answering suggests that you missed something small in the process that is hard to find from the outside.

One thing about your description that raises warning flags for me is the large amount of software you installed and configured before testing the basic service. Particularly since this is your first time deploying an EC2 instance, I would suggest you spend a couple of hours to create a new instance from scratch as a testbed, to see if you can either reproduce the problem or get further:

  1. Create a new micro instance of Ubuntu 12.04, purely as a testbed
  2. Assign it into your custom security group so it uses the same security
  3. Assign it a new (temporary) ElasticIP (no DNS, domain name, etc)
  4. Start up Apache, only. Install no other software (ruby, RVM, Passenger, etc)

With the basic config and your stated security rules, you should be able to get to the standard Apache "It Works" page on the temporary ElasticIP. Only after getting the webserver answering properly should you do the rest of your install.

  • Thanks! This is great advice. Next time, I will make sure I can serve static content from my instance before bringing Ruby into it. I'd upvote your answer, but I don't have enough points :) I'm posting my own solution for any future Googlers out there... – Becky Russoniello Jul 21 '12 at 18:43
  • and, now I have enough points, so upvoting! – Becky Russoniello Jul 21 '12 at 19:39

So, it turned out the problem was actually with Passenger.

My advice to future Googlers with a similar mysterious problem: put an index.html file into your public directory (for example, either the standard Ruby on Rails one or the Apache 'it works!' page) and see if your instance serves it.

For me, I assumed that if the error was with Passenger or Rails, that I would at least get some kind of error page, rather than a time-out. I learned this is not necessarily so.

Anyway, it turned out that g++ (GNU's C compiler) was failing to compile some files for Passenger. Uninstalling and reinstalling each did not help. After some research into the alternatives, I went with Unicorn instead, and my app is up and running.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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