Rails 4 nginx y unicorn solo sirven archivos públicos (html)

Running Ubuntu 12.10 x64, Nginx, Unicorn, Rails 4

bundle exec rake routes shows all the routes correctly, but when I access any routes (controller/action) it times out (nginx 504). When I open any static HTML files (public directory), it works fine.

Tried restarting server, nginx, unicorn, installed all the gems. What else am I missing?

This is my unicorn log http://pastebin.com/5BHzqCA9

preguntado el 09 de septiembre de 13 a las 21:09

1 Respuestas

You have to add socket file to unicornio.rb config file and set it for listener. Something like this:

sock_file = "path/to/unicorn.sock"
......
listen sock_file

In your nginx conf you need:

upstream rails_server {
   server unix:/path/to/sock;
}
server {
 listen  80;
 server_name  example.com;
 root /path/to/public;
 access_log /path/to/log/nginx_access.log;
 error_page   500 502 503 504  /50x.html;
location = /50x.html {
     root   /path/to/public;
 }
try_files $uri, @rails;
 location @rails {
 proxy_pass http://rails_server;
 proxy_set_header X-Forwarder-For $proxy_add_x_forwarded_for;
 proxy_set_header Host $http_host;
 proxy_redirect off;
 }
}

Respondido el 10 de Septiembre de 13 a las 14:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.