0

Cluster of 3 files (err.log,chat.yml,chat.conf for Nginx) :

err.log :

2015/03/19 15:05:50 [crit] 1535#0: *79 connect() to unix:/var/www/chat/public/tmp/sockets/thin.0.sock failed (2: No such file or directory) while connecting to upstream, client: 162.243.6.35, server: chat.stackin.money, request: "GET / HTTP/1.1", upstream: "http://unix:/var/www/chat/public/tmp/sockets/thin.0.sock:/", host: "chat.stackin.money"
2015/03/19 15:05:50 [crit] 1535#0: *79 connect() to unix:/var/www/chat/public/tmp/sockets/thin.1.sock failed (2: No such file or directory) while connecting to upstream, client: 162.243.6.35, server: chat.stackin.money, request: "GET / HTTP/1.1", upstream: "http://unix:/var/www/chat/public/tmp/sockets/thin.0.sock:/", host: "chat.stackin.money"

chat.conf :

upstream stackin_money {
  ip_hash;
  server unix:/var/www/chat/public/tmp/sockets/thin.0.sock max_fails=1 fail_timeout=15s;
  server unix:/var/www/chat/public/tmp/sockets/thin.1.sock max_fails=1 fail_timeout=15s;
}

server {

  listen 80;
  server_name chat.stackin.money;

  location / {
    proxy_pass http://stackin_money;
    proxy_set_header HOST $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

  root /var/www/chat/public;

 # access_log /var/log/nginx/access.log;
 # error_log /var/log/nginx/error.log;

}

chat.yml :

user: root
group: root
pid: tmp/pids/thin.pid
timeout: 30
wait: 30
log: /var/log/thin/thin.log
max_conns: 1024
require: []
environment: production
max_persistent_conns: 512
servers: 2
onebyone: true
threaded: true
no-epoll: true
daemonize: true
socket: tmp/sockets/thin.sock
chdir: /var/www/chat/public
tag: chat aux

So I'm running a sinatra application that uses thin as its server for a real-time chat and since I want this running on a sub-domain I'm using Nginx to reverse proxy. However, I'm running into a few problems with either Nginx or Thin(got error from Nginx's error log) that it cant find a file or directory that I specified in the chat.yml of Thin sockets here(below). Its true, its not there at all.

Any help? Thanks in advance

Xavier Lucas
  • 12,815
  • 2
  • 44
  • 50
Vikaton
  • 105
  • 4

1 Answers1

2

Look in /var/www/chat/public/tmp/sockets/ - does thin.0.sock actually exist? As far as I know, Thin only supports TCP sockets, not Unix sockets. If you copied the Unix socket thing from a Unicorn-specific example, that would explain it, since Unicorn does support them.

I suggest changing the upstream definition block to say server http://127.0.0.1:4567 or something like that (whatever port the Thin process uses).

Rennex
  • 136
  • 2