Nginx Rails app can't deploy
- by user3596718
I have an issue with my rails application running with passenger and nginx hosted in Ubuntu 12.04.
In the nginx.conf file below, my "example.com" (Regular HTML) and "redmine.example.com" (Rails app) are working perfectly, but my "crete.example.com" (Another Rails app) is showing "502 bad gateway". I have them both hosted in /var/data with the same permissions and ownerships, also tried different ports, I can't think of something else to try.
worker_processes 1;
events {
worker_connections 1024;
}
http {
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server{
listen 80;
server_name example.com;
root /opt/nginx/html;
}
server{
server_name redmine.example.com;
root /var/data/redmine/public;
passenger_enabled on;
location ~ ^/<SUBURI>(/.*|$){
alias /var/data/redmine/public$1;
passenger_base_uri /redmine;
passenger_app_root /var/data/redmine;
passenger_document_root /var/data/redmine/public;
passenger_enabled on;}
}
server{
server_name crete.example.com;
root /var/data/crete/public;
passenger_enabled on;
location ~ ^/<SUBURI>(/.*|$){
alias /var/data/crete/public$1;
passenger_base_uri /crete;
passenger_app_root /var/data/crete;
passenger_document_root /var/data/crete/public;
passenger_enabled on;}
}
}
This are my Ruby and Rails versions:
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-linux]
Rails 4.1.0
My nginx error.log
2014/05/02 12:29:50 [error] 3343#0: *4 upstream prematurely closed connection while reading response header from upstream, client: xxx.xx.xx.xx, server: crete.example.com, request: "GET / HTTP/1.1", upstream: "passenger:/tmp/passenger.1.0.3
323/generation-0/request:", host: "crete.example.com"
Any other conf file you might need to solve this don't hesitate to ask.