0

I've seen all of the other questions on here but none of them seem to work for me. Whenever I try and access my site I'm getting a connection refused error through the nginx logs. I'm assuming there is a permissions problem or someone is listening on the wrong port. Here's the error I get.

2014/10/06 10:13:50 [crit] 18027#0: *1 connect() to unix:/var/www/reportcard/dev/pids/unicorn.pid failed (13: Permission denied) while connecting to upstream, client: my_ip, server: dev.reportcard.io, request: "GET / HTTP/1.1", upstream: "http: //unix:/var/www/reportcard/dev/pids/unicorn.pid:/", host: "dev.reportcard.io"

I have a rails app located in /var/www/reportcard/dev and the out of ls -l for it are:

drwxr-xr-x 9 ghost    ghost    4096 Sep 19 11:38 ghost
drwxr-xr-x 3 www-data www-data 4096 Jun  2 15:21 park
drwxr-xr-x 3 willkara www-data 4096 Jul 29 15:33 reportcard

Here's the ls -l for reportcard

drwxr-xr-x 14 willkara www-data 4096 Jul 29 15:55 dev
-rwxr-xr-x  1 willkara www-data   56 Jul 28 20:17 index.html

Here's the ps -ef | grep unicorn output.

root@slimer:/var/www# ps -ef | grep unicorn
willkara 14265     1  0 15:54 ?        00:00:00 unicorn_rails master -c config/unicorn.rb -D -E development
willkara 14268 14265  0 15:54 ?        00:00:02 unicorn_rails worker[0] -c config/unicorn.rb -D -E development

Here's the ps -ef | grep output for nginx

willkara@slimer:/var/www/reportcard/dev$ ps -ef | grep nginx
root     18026     1  0 10:13 ?        00:00:00 nginx: master process /usr/sbin/nginx
www-data 18027 18026  0 10:13 ?        00:00:00 nginx: worker process
www-data 18028 18026  0 10:13 ?        00:00:00 nginx: worker process
willkara 18073 19220  0 10:14 pts/0    00:00:00 grep --color=auto nginx

The unicorn config file looks like:

  1 # Set the working application directory
  2 # working_directory "/path/to/your/app"
  3 working_directory "/var/www/reportcard/dev"
  4
  5 # Unicorn PID file location
  6 # pid "/path/to/pids/unicorn.pid"
  7 pid "/var/www/reportcard/dev/pids/unicorn.pid"
  8
  9 # Path to logs
 10 # stderr_path "/path/to/log/unicorn.log"
 11 # stdout_path "/path/to/log/unicorn.log"
 12 stderr_path "/var/www/reportcard/dev/log/unicorn.log"
 13 stdout_path "/var/www/reportcard/dev/log/unicorn.log"
 14
 15 # Unicorn socket
 16 listen "/tmp/unicorn.reportcard.sock"
 17
 18 # Number of processes
 19 # worker_processes 4
 20 worker_processes 2
 21
 22 # Time-out
 23 timeout 30

And the nginx config for the site looks like:

upstream app {
    # Path to Unicorn SOCK file, as defined previously
    server unix:/var/www/reportcard/dev/pids/unicorn.pid fail_timeout=0;
}

server {


    listen 80;
    server_name dev.reportcard.io;

    # Application root, as defined previously
    root /var/www/reportcard/dev/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;
    }

    error_page 500 502 503 504 /500.html;
    client_max_body_size 4G;
    keepalive_timeout 10;
}
Sempus
  • 342
  • 1
  • 2
  • 11

1 Answers1

0

I believe the line in your nginx config that reads

server unix:/var/www/reportcard/dev/pids/unicorn.pid fail_timeout=0;

should actually be your socket instead of your pid.

eddiezane
  • 116
  • 2