ruby on rails - Nginx/Unicorn: Upstream timed out (110: Connection timed out) while reading response header from upstream -


i getting upstream timeout error in rails nginx/unicorn server. have tried fix did not find solution can work me.

i pasting exact error getting in nginx error.log file:

 upstream timed out (110: connection timed out) while reading response header upstream, client: xxx.xxx.xxx.xxx, server: default_server, request: "get / http/1.1", upstream: "http://unix:/tmp/unicorn.todo.socket/", host: "xxx.xxx.xxx.xxx" 

i following below 2 blogs setting nginx , unicorn ruby on rails app in ubuntu ec2 machine:

  1. https://gist.github.com/billie66/3696537
  2. https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-unicorn-and-nginx-on-ubuntu-14-04

i able run server in production environment on port 3000 now, in need run server on port 80 can point dns server ip. have used following methods make running:

  • unicorn.todo.socket there being created after running application on unicorn using command - unicorn -c config/unicorn.rb -e production

  • in sites-available/default, configurations right including upstream.

  • in sites-enabled/default, configuration same sites-available/default these both linked. file included in nginx.conf file inside /etc/nginx/ directory.

  • in log, getting error of upstream timeout. showing nginx taking time connect unicorn.todo.socket not debug part configuration right , running same thing on other server properly.

  • i have checked using 'sudo nginx -t' command nginx configuration , showing ok.

  • after timeout, getting error of ruby 500 page in public folder, means path , other configuration right.

  • i have removed nginx , related component , re-installed server again, no success again.

  • when run sudo service nginx restart, restarts nginx , can see nginx server running pid.

  • i have changed path unicorn.rb listen path , not working.

  • the unicorn version using server, working on server did not change this.

  • added proxy_read_timeout 150 not working.

please check above things have tried , let me know if missing run server using nginx/unicorn on port 80.


/etc/nginx/sites-enabled/default

upstream app {   server unix:/tmp/unicorn.todo.socket fail_timeout=0; }  server {   listen 80 default_server;   listen [::]:80 default_server;   server_name default_server;   root /home/ubuntu/<project_folder>/public;    try_files $uri/index.html $uri @app;    location @app {       proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;       proxy_set_header host $http_host;       proxy_redirect off;       proxy_pass http://app;       proxy_read_timeout 150;   }   error_page 500 502 503 504 /500.html;   client_max_body_size 4g;   keepalive_timeout 10; } 

i faced same issue. in order fix checked /var/log/unicorn/unicorn.log file , found imagemagick missing.

to fix on ubuntu:

sudo apt-get install imagemagick 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -