Question

Unable to connect on deploying a rails app with Nginx, Capistrano and Puma on Ubuntu 16.04

Hello:

I am trying to deploy my rails app on Ubuntu 16.04 adapting this tutorial.

I have gone through all the steps and when I visit the IP address I get “unable to connect, Firefox can’t establish a connection to the server at IP address”

I have checked my logs and none of them show any sign of errors: nginx.access.log

41.82.2.246 - - [20/Mar/2017:13:26:04 +0000] "GET / HTTP/1.1" 301 5 "-" "Mozilla/5.0 (Macintosh; Intel M$
51.36.233.18 - - [20/Mar/2017:13:29:22 +0000] "\xC1\x99[\xB21\xA9\x92" 400 182 "-" "-"
51.36.233.18 - - [20/Mar/2017:13:29:23 +0000] "\xDEzx\xFC\x0C\xC6\x8D\xD3\xD9\x1A\xE1\x1F\xC4\xD0\xF0/\x$
51.36.233.18 - - [20/Mar/2017:13:29:23 +0000] "\xA5\xA8\xBCq\x16\xA6\xEC\xC2\xF7\x0Fz\xEAn\x83\xD92xu\xB$

nginx.error.log

[info] 3003#3003: *3 client sent invalid method while reading client request line, c$
[info] 3003#3003: *4 client sent invalid method while reading client request line, c$
[info] 3003#3003: *5 client sent invalid method while reading client request line, c$
[info] 3003#3003: *6 client closed connection while waiting for request, client: 41.$

puma.error.log

* Listening on unix:///home/deploy/apps/appname/shared/tmp/sockets/appname-puma.sock

puma.access.log

=== puma startup: 2017-03-20 13:24:07 +0000 ===

production.log - shows migrations, last lines are

I, [2017-03-20T13:24:03.303477 #2436]  INFO -- : Migrating to AddGuidToPrescriptions (20170310185442)
D, [2017-03-20T13:24:03.304288 #2436] DEBUG -- :   ^[[1m^[[35m (0.1ms)^[[0m  ^[[1m^[[35mBEGIN^[[0m
D, [2017-03-20T13:24:03.305111 #2436] DEBUG -- :   ^[[1m^[[35m (0.3ms)^[[0m  ^[[1m^[[35mALTER TABLE "pre$
D, [2017-03-20T13:24:03.306443 #2436] DEBUG -- :   ^[[1m^[[35mSQL (0.3ms)^[[0m  ^[[1m^[[32mINSERT INTO "$
D, [2017-03-20T13:24:03.307318 #2436] DEBUG -- :   ^[[1m^[[35m (0.6ms)^[[0m  ^[[1m^[[35mCOMMIT^[[0m
D, [2017-03-20T13:24:03.310861 #2436] DEBUG -- :   ^[[1m^[[36mActiveRecord::InternalMetadata Load (0.3ms$
D, [2017-03-20T13:24:03.317530 #2436] DEBUG -- :   ^[[1m^[[35m (0.2ms)^[[0m  ^[[1m^[[35mBEGIN^[[0m
D, [2017-03-20T13:24:03.319872 #2436] DEBUG -- :   ^[[1m^[[35mSQL (0.7ms)^[[0m  ^[[1m^[[32mINSERT INTO "$
D, [2017-03-20T13:24:03.322738 #2436] DEBUG -- :   ^[[1m^[[35m (2.5ms)^[[0m  ^[[1m^[[35mCOMMIT^[[0m
D, [2017-03-20T13:24:03.323393 #2436] DEBUG -- :   ^[[1m^[[35m (0.4ms)^[[0m  ^[[1m^[[34mSELECT pg_adviso$

All input and help welcome thanks!

Subscribe
Share

@hansen Thanks for taking a look. If there is no firewall by default then there is none as I haven’t set any. I have set up the port in deploy.rb @ 22 nginx.conf

upstream puma {
  server unix:///home/deploy/apps/appname/shared/tmp/sockets/appname-puma.sock;
}

server {
  listen 80 default_server deferred;
  # server_name example.com;

  root /home/deploy/apps/appname/current/public;
  access_log /home/deploy/apps/appname/current/log/nginx.access.log;
  error_log /home/deploy/apps/appname/current/log/nginx.error.log info;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @puma;
  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://puma;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 10M;
  keepalive_timeout 10;
}

deploy.rb

server 'IP_ADDRESS', port: 22, roles: [:web, :app, :db], primary: true

set :repo_url,        'git@bitbucket.org:pivnist/appname.git'
set :application,     'appname'
set :user,            'deploy'
set :puma_threads,    [4, 16]
set :puma_workers,    0

#rest won't load on comment but its same as tutorial

@pianist You need to supply your configurations. By the way, are you running a firewall and have you opened for traffic on the ports?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!