1
votes

Trying to set this all up on digitalocean, followed a tutorial, still doesn't work.

gunicorn.conf

description "Gunicorn application server handling stocksearch"

start on runlevel [2345]
stop on runlevel [!2345]


setuid david
setgid www-data
chdir /home/david/stocksearch/stocksearch

exec /home/david/.virtualenvs/stocksearch/bin/gunicorn --workers 3 --bind unix:/home/david/stocksearch/stocksearch/stocksearch.sock stocksearch.wsgi:application

Nginx config:

server {
    listen 80;
    server_name 128.199.36.78;


    location /static/ {
        root /home/david/stocksearch/stocksearch;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/david/stocksearch/stocksearch/stocksearch.sock;
    }
}

Django:

# -*- coding: utf-8 -*-
from .base import *

DEBUG = False

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'stocksearch_db',
        'USER': 'david',
        'PASSWORD': 'david',
        'HOST': '',
        'PORT': '',
    }
}


STATIC_ROOT = os.path.dirname(BASE_DIR)
STATIC_URL = '/static/'

nginx logs:

2015/10/06 20:56:15 [error] 30688#0: *37 connect() to unix:/home/david/stocksearch/stocksearch/stocksearch.sock failed (111: Connection refused) while connecting to upstream, client: 79.176.114.181, server: 128.199.36.78, request: "GET / HTTP/1.1", upstream: "http://unix:/home/david/stocksearch/stocksearch/stocksearch.sock:/", host: "128.199.36.78" 2015/10/06 20:56:15 [error] 30688#0: *37 connect() to unix:/home/david/stocksearch/stocksearch/stocksearch.sock failed (111: Connection refused) while connecting to upstream, client: 79.176.114.181, server: 128.199.36.78, request: "GET / HTTP/1.1", upstream: "http://unix:/home/david/stocksearch/stocksearch/stocksearch.sock:/", host: "128.199.36.78"

gunicorn logs:

self.halt(reason=inst.reason, exit_status=inst.exit_status) File "/home/david/.virtualenvs/stocksearch/lib/python3.4/site-packages/gunicorn/arbiter.py", line 297, in halt self.stop() File "/home/david/.virtualenvs/stocksearch/lib/python3.4/site-packages/gunicorn/arbiter.py", line 342, in stop time.sleep(0.1) File "/home/david/.virtualenvs/stocksearch/lib/python3.4/site-packages/gunicorn/arbiter.py", line 214, in handle_chld self.reap_workers() File "/home/david/.virtualenvs/stocksearch/lib/python3.4/site-packages/gunicorn/arbiter.py", line 459, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer:

1

1 Answers

0
votes

I would make sure that all the necessary directories are created and that they have the right permissions.