Vitor Oliveira
Vitor Oliveira

Reputation: 414

Nginx configuration is not starting a rails server

I am trying to config an amazon EC2. Ubuntu 14.04. I am getting this message on nginx access.log

2015/12/25 11:19:24 [error] 4403#0: *1 connect() to unix:/home/ubuntu/apptest/shared/puma.sock failed (111: Connection refused) while connecting to upstream, client: 109.67.134.46, server: localhost, request: "GET / HTTP/1.1", upstream: "http://unix:/home/ubuntu/apptest/shared/puma.sock:/", host: "54.174.110.190"

My /etc/nginx/sites-enabled/apptest.conf is

upstream apptest {
    # Path to Puma SOCK file, as defined previously
    server unix:/home/ubuntu/apptest/shared/puma.sock fail_timeout=0;
}

server {
    listen 80;
    server_name localhost;

    root /home/ubuntu/apptest/current/public;

    try_files $uri/index.html $uri @apptest;

    location @apptest {
        proxy_pass http://apptest;
        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;
}

but when I run **bundle exec puma -e production -b unix:///home/ubuntu/apptest/shared/puma.sock** in the server

[4328] Puma starting in cluster mode...

[4328] * Version 2.15.3 (ruby 2.2.1-p85), codename: Autumn Arbor Airbrush

[4328] * Min threads: 1, max threads: 6

[4328] * Environment: production

[4328] * Process workers: 1

[4328] * Phased restart available

[4328] * Listening on unix:///home/ubuntu/apptest/shared/puma.sock

the website loads. Any suggestions?

Upvotes: 1

Views: 245

Answers (1)

sqbell
sqbell

Reputation: 121

AFAIK Puma will not be started automatically by Nginx. It has to be started on its own. There are some useful scripts in the official Puma repository.

Upvotes: 1

Related Questions