EC2 Bad Gateway with torquebox and nginx

422 views Asked by At

I set up an EC2 instance (Centos 6.5) with torquebox and nginx. Torquebox starts without any errors, but I cannot access it at port 8080. Not even if I add a VPC rule to open that port.

I get Gateway timed out if I go diectly to myip:8080 and Bad gateway if I visit myip with this nginx config:

server {
  listen 80 default deferred;
  # server_name ;
    location / {
      access_log off;
      proxy_pass http://127.0.0.1:8080;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

I tried to set proxy_pass to the server ip but that did not help either.

The nginx log contains the following error:

connect() failed (113: No route to host) while connecting to upstream, client: "myip", server: , request: "GET / HTTP/1.1", upstream "http://"myserverip":8080/", host: "myserverip"

I tried to just run rails s and visited myip:3000 and the test rails app was running perfectly.

Any ideas how to solve this?

1

There are 1 answers

1
Toby Crawley On

How are you starting TorqueBox? It binds to localhost by default, so you'll either need to have it bind to and external interface, or have nginx talk to localhost:8080.