I an getting this error:
2016/09/29 01:05:39 [error] 7169#0: *3 connect() to unix:/home/deploy/tasks/shared/tmp/sockets/puma.sock failed (111: Connection refused) while connecting to upstream, client: 99.254.197.158, server: localhost, request: "GET / HTTP/1.1", upstream: "http://unix:/home/deploy/tasks/shared/tmp/sockets/puma.sock:/", host: "ec2-54-88-181-57.compute-1.amazonaws.com"
When trying to use this URL for my app:
http://ec2-54-88-181-57.compute-1.amazonaws.com/
The browser also presents the this message:
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
However I am able to access my app when using Puma directly on port 3000 using this URL:
http://ec2-54-88-181-57.compute-1.amazonaws.com:3000/
And I am able to navigate through all pages of the app this way.
Here are some of my configuration files:
$ ls -l /etc/nginx/sites-enabled
total 0
lrwxrwxrwx 1 root root 34 Sep 28 22:46 default -> /etc/nginx/sites-available/default
$ sudo cat /etc/nginx/nginx.conf
[sudo] password for deploy:
user root; #www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
$ sudo cat /etc/nginx/sites-available/default
upstream app {
# Path to Puma SOCK file, as defined previously
server unix:/home/deploy/tasks/shared/tmp/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
root /home/deploy/tasks/current/public;
try_files $uri/index.html $uri @app;
location @app {
proxy_pass http://app;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
The server is listening on ports 80, 22 and 3000 (for Puma)
$ netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN
tcp 0 280 172.31.51.143:22 99.254.197.158:60843 ESTABLISHED
tcp 0 0 172.31.51.143:22 99.254.197.158:60842 ESTABLISHED
tcp 0 0 172.31.51.143:59545 172.31.47.0:5432 ESTABLISHED
tcp 0 0 172.31.51.143:59544 172.31.47.0:5432 ESTABLISHED
tcp6 0 0 :::22 :::* LISTEN
udp 0 0 0.0.0.0:55159 0.0.0.0:*
udp 0 0 0.0.0.0:68 0.0.0.0:*
udp6 0 0 :::12784 :::*
Nginx and Puma are running.
$ ps -ef | grep nginx
root 1644 1586 0 01:21 pts/0 00:00:00 sudo tail -f /var/log/nginx/error.log
root 1645 1644 0 01:21 pts/0 00:00:00 tail -f /var/log/nginx/error.log
root 1698 1 0 01:39 ? 00:00:00 nginx: master process /usr/sbin/nginx
root 1701 1698 0 01:39 ? 00:00:00 nginx: worker process
root 1702 1698 0 01:39 ? 00:00:00 nginx: worker process
root 1703 1698 0 01:39 ? 00:00:00 nginx: worker process
root 1704 1698 0 01:39 ? 00:00:00 nginx: worker process
deploy 1736 1309 0 02:13 pts/1 00:00:00 grep nginx
$ ps -ef | grep puma
deploy 1564 1 0 01:20 ? 00:00:00 puma 3.6.0 (tcp://0.0.0.0:3000) [20160928212850]
deploy 1571 1564 0 01:20 ? 00:00:01 puma: cluster worker 0: 1564 [20160928212850]
I am deploying with Capistrano to an AWS EC2 Ubuntu 14.04 server. There are no errors related to deployments.
I fetched all blogs / post I found but none of these solutions there worked for me so far.
What I shall try next in order to have the Nginx server working?