I'm try to run my rails apps on production (vps).
I'm using rbenv, unicorn, nginx, os ubuntu server..
I have config unicorn and nginx :
file : config/unicorn.rb
app_dir = "/home/axx/apps/axx"
working_directory "/home/axx/apps/axx"
pid "/home/axx/apps/axx/tmp/pids/unicorn.pid"
stderr_path "/home/axx/apps/axx/unicorn/unicorn.log"
stdout_path "/home/axx/apps/axx/unicorn/unicorn.log"
listen "/home/axx/apps/axx/tmp/sockets/unicorn.axx.sock"
worker_processes 2
timeout 30
file : /etc/nginx/sites-available/default
upstream app_server {
server unix:/home/axx/apps/axx/tmp/sockets/unicorn.axx.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
root home/axx/apps/axx/public;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
}
}
but when I access my site, I get 502 error. Also I go check unicorn and nginx :
nginx/error.log
connect() to unix:/home/axx/apps/axx/tmp/sockets/unicorn.axx.sock failed (111: Connection refused) while connecting to upstream,
I try to search some questions in this site and also googling too, but I can't solve my problem.