1

I am deploying a rails application to a digital ocean VPS. I have followed https://coderwall.com/p/yz8cha . All things done well, but now the browser shows only a blank page.

Nginx log contains:

2014/08/04 03:07:20 [crit] 20550#0: *4 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connectin$
2014/08/04 03:08:39 [crit] 20550#0: *11 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connecti$
2014/08/04 03:08:40 [crit] 20550#0: *11 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connecti$
2014/08/04 03:08:41 [crit] 20550#0: *11 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connecti$
2014/08/04 03:08:41 [crit] 20550#0: *11 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connecti$
2014/08/04 03:08:42 [crit] 20550#0: *11 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connecti$
2014/08/04 03:08:42 [crit] 20550#0: *14 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connecti$
2014/08/04 03:08:42 [crit] 20550#0: *19 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connecti$
2014/08/04 04:15:01 [error] 22883#0: *19 connect() failed (111: Connection refused) while connecting to upstream, client: 202.88.237.208, serv$
2014/08/04 04:40:46 [error] 29378#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 202.88.237.208, serve$
2014/08/04 04:45:22 [error] 29378#0: *10 connect() failed (111: Connection refused) while connecting to upstream, client: 202.88.237.208, serv$
2014/08/04 04:49:48 [crit] 31073#0: *1 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connectin$
2014/08/04 04:58:19 [crit] 31073#0: *4 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connectin$
2014/08/04 04:58:38 [crit] 31073#0: *7 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connectin$
2014/08/04 04:59:45 [crit] 32683#0: *1 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connectin$
2014/08/04 05:00:28 [crit] 32683#0: *4 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connectin$
2014/08/04 05:00:29 [crit] 32683#0: *4 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connectin$
2014/08/04 05:08:15 [crit] 32683#0: *8 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connectin$
2014/08/04 05:09:50 [crit] 32683#0: *11 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connecti$
2014/08/04 05:30:02 [crit] 32683#0: *14 connect() to unix:/var/run/unicorn.testvpsdo.sock failed (2: No such file or directory) while connecti$

I have changed the directory and now error shows:

2014/08/04 05:34:18 [emerg] 1985#0: invalid host in upstream "/tmp/unicorn.testvpsdo.sock" in /etc/nginx/sites-enabled/testvpsdo:2
2014/08/04 05:36:35 [emerg] 2459#0: invalid host in upstream "/tmp/unicorn.testvpsdo.sock" in /etc/nginx/sites-enabled/testvpsdo:2

Nginx config:

 upstream unicorn {
     server unix:/tmp/unicorn.testvpsdo.sock fail_timeout=0;
 }

 server {
     listen 80 default_server deferred;
     # server_name example.com;
     root /home/navin/apps/testvpsdo/current/public;

     location ^~ /assets/ {
         gzip_static on;
         expires max;
         add_header Cache-Control public;
     }

     try_files $uri/index.html $uri @unicorn;

     location @unicorn {
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header Host $http_host;
         proxy_redirect off;
         proxy_pass http://unicorn;
     }

     error_page 500 502 503 504 /500.html;
     client_max_body_size 20M;
     keepalive_timeout 10;
}

I don't know how to fix it even though I searched through many websites.

grekasius
  • 2,056
  • 12
  • 15
navinspm
  • 11
  • 5

1 Answers1

1

The nginx can not access your socket file due to permissions. Try that:

sudo mkdir /var/sockets
sudo chmod -R 755 /var/sockets
sudo mv /tmp/unicorn.testvpsdo.sock /var/sockets/unicorn.testvpsdo.sock

Then specify the new socket directory in the nginx.conf and in the unicorn.rb file. Redeploy and see what happens.

fschuindt
  • 111
  • 2