D
D
devpledge2015-09-13 16:39:04
linux
devpledge, 2015-09-13 16:39:04

How to localize error when running uWSGI+nginx via UNIX socket?

Good afternoon.
After running uWSGI on a VPS server, I get a Connection Refused error in the browser. At the same time, there are no errors in the nginx and uwsgi logs at all, both processes are working.
If I run uWSGI without nginx (via tcp port) - no problem.
If I run nginx without the participation of uWSGI (for distributing statics) - there are no problems.
However, running the application (django) on the web fails. Previously, on the same VPS, the bundle worked on CentOS in the same configuration without errors.
Versions used:
Fedora 22
nginx 1.8.0
uWSGI 2.0.11.1
uwsgi_nginx.conf:

upstream django {
    server unix:///projects/monadm/monadm.sock; 
    # server 127.0.0.1:8001; 
}

server {
    listen      8000;
    server_name     188.166.103.94;
    charset     utf-8;

    client_max_body_size 75M;

    location /media  {
        alias /projects/monadm/media;  
    }

    location /static {
        alias /projects/monadm/static; 

    }

    location / {
        uwsgi_pass  django;
        include     /projects/monadm/uwsgi_params;
    }
}

nginx.conf:
# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

uwsgi_params:
uwsgi_param  QUERY_STRING       $query_string;
uwsgi_param  REQUEST_METHOD     $request_method;
uwsgi_param  CONTENT_TYPE       $content_type;
uwsgi_param  CONTENT_LENGTH     $content_length;

uwsgi_param  REQUEST_URI        $request_uri;
uwsgi_param  PATH_INFO          $document_uri;
uwsgi_param  DOCUMENT_ROOT      $document_root;
uwsgi_param  SERVER_PROTOCOL    $server_protocol;
uwsgi_param  REQUEST_SCHEME     $scheme;
uwsgi_param  HTTPS              $https if_not_empty;

uwsgi_param  REMOTE_ADDR        $remote_addr;
uwsgi_param  REMOTE_PORT        $remote_port;
uwsgi_param  SERVER_PORT        $server_port;
uwsgi_param  SERVER_NAME        $server_name;

I do not apply uwsgi.ini, the error persists even when launched by the command
uwsgi --socket monadm.sock --module monadm.wsgi --chmod-socket=666

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2015-09-13
@devpledge

permissions to /projects/monadm/monadm.sock ?

S
sim3x, 2015-09-13
@sim3x

somehow it needs to be done

[uwsgi]
chdir=/path/to/prog
virtualenv=/path/to/virtualenv
module=PROJECT_NAME.wsgi:application

pidfile=/var/run/PROJ_NAME_uwsgi.pid
socket=/tmp/PROJ_NAME_wsgi.sock
chmod-socket = 600

vacuum=True
master=True
processes=10

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question