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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With