Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't start unicorn, master failed to start, check stderr log for details

I dont know what’s wrong with the unicorn.rb file. my unicorn.rb config is

APP_PATH = "/var/www/demo"
working_directory APP_PATH

stderr_path APP_PATH + "/log/unicorn.stderr.log"
stdout_path APP_PATH + "/log/unicorn.stderr.log"

pid APP_PATH + "/tmp/pid/unicorn.pid"

running nginx successful.

sudo servier nginx start
sudo unicorn -c /var/www/demo/config/unicorn.rb -D
like image 448
Pravin Mishra Avatar asked Jun 22 '13 09:06

Pravin Mishra


1 Answers

The socket is the "file" that nginx and unicorn use as a channel for all communication between them. Where have you defined it? In our unicorn configs, we usually have a line like this:

listen APP_PATH + "/tmp/pid/.unicorn.sock

Then, in your nginx.conf, you need to tell nginx about this socket, e.g.:

upstream unicorn {
  server unix:/var/www/demo/tmp/pid/.unicorn.sock fail_timeout=0;
}

location / {
  root /var/www/demo/current/public ;
  try_files $uri @unicorns;
}

location @unicorns {
  proxy_pass http://unicorn;
}

In this config file, the first section defines how nginx can reach unicorn. The second one actually routes requests to an abstract location "@unicorns" which, in turn, is defined in the last section. This way you can reuse the @unicorns shorthand if your have more complex nginx routing going on.

like image 87
Frank C. Schuetz Avatar answered Oct 15 '22 11:10

Frank C. Schuetz