Rails 4 App with Nginx and Unicorn OK in Development but not in Production -


i setup server of "how deploy rails apps using unicorn & nginx on centos 6.5" great if run if start unicorn in development have lot of issues if try start in production.

i cant unicorn start @ if don't use absolute "listen" path in unicorn.rb. if use absolute path unicorn start nginx when go site nginx "502 bad gateway" error page.

current unicorn.rb working in development

working_directory "/var/www/yourappname" pid "/var/www/yourappname/pids/unicorn.pid" listen "/tmp/unicorn.yourappname.sock"  stderrpath "/var/www/yourappname/log/unicornerr.log" stdoutpath "/dev/null"  worker_processes 2 timeout 30 

current nginx default.conf working in development

upstream yourappname { server unix:/tmp/unicorn.yourappname.sock fail_timeout=0; }  server {  listen 80; server_name localhost;  root /root/yourappname/public;  try_files $uri/index.html $uri @yourappname;  location @yourappname { proxysetheader x-forwarded-for $proxyaddxforwardedfor; proxysetheader host $httphost; proxyredirect off; proxy_pass http://yourappname; }  errorpage 500 502 503 504 /500.html; clientmaxbodysize 4g; keepalive_timeout 10; } 


Comments