Rails 4 nginx y unicorn solo sirven archivos públicos (html)
Frecuentes
Visto 803 veces
0
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
1 Respuestas
0
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 ruby-on-rails ruby ubuntu nginx unicorn or haz tu propia pregunta.
URL: 192.241.247.216, route: 192.241.247.216/static_pages/home (cl.ly/image/1Q3d0F2T3O2s) - alexndm