1

I'm trying to deploy my first django project, i'm using uwsgi and nginx on a linode server. Basically I follow the next steps.

  1. Create uwsgi config file for my project on /etc/uwsgi/apps-available/, and create the symbolic link on /etc/uwsgi/apps-enabled/:

    [uwsgi]
    plugins = http,python
    env = DJANGO_SETTINGS_MODULE=app.settings
    chdir = /opt/deploy/.virtualenvs/test_app/test/
    home = /opt/deploy/.virtualenvs/test_app/
    module = django.core.handlers.wsgi:WSGIHandler()
    processes = 4
    idle = 3600
    touch-reload = /opt/deploy/.virtualenvs/test_app/test/app/local_settings.py
    
  2. Create my nginx config file on /etc/nginx/sites-available/ and create the symbolic link in cd nginx/sites-enabled/, this is my nginx file:

    server {
        server_name  www.test.com;
        rewrite ^(.*) http://test.com$1 permanent;
    }
    server {
        listen       80;
        server_name  test.com;
        charset      utf-8;
    
        client_max_body_size       10m;
        client_body_buffer_size    128k;
    
        # serve static files
        location /static/ {
            alias /opt/deploy/.virtualenvs/test_app/test/app/static/;
        }
    
        location / {
            include        uwsgi_params;
            uwsgi_pass     unix:/run/uwsgi/app/test.sock;
        }
    }
    
  3. Restart uwsgi and nginx.

I expect find the file test.sock on run/uwsgi/app/, but the file is not created. When a see the nignx error log I have this line:

2015/10/02 01:47:49 [crit] 8967#0: *51 connect() to unix:/run/uwsgi/app/test.sock failed (2: No such file or directory) while connecting to upstream, client: 181.135.143.435, server: test.com, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:/run/uwsgi/app/test.sock:", host: "test.com"

Why can i do for generate the uwsgi file?, thankyou so much I know that could be a stupid question but before to do this write a look for a lot of tutorials and can't find any solution.. thank you.

2 Answers 2

1

Maybe you need some special permissions to generate the socket file on the location /run/uwsgi/app/. If you put it in /tmp/test.sock, the socket should be generated correctly.

Sign up to request clarification or add additional context in comments.

Comments

0

You are missing a part in your config. Here is a working config from my server:

upstream django-myhome {
    server unix:///home/myhome/myhome/myhome.sock; # for a file socket
}
server
    location / {
        uwsgi_pass  django-myhome;
        include     /home/myhome/myhome/uwsgi_params; # the uwsgi_params file you installed
    }

Be also sure that you have the right permissions to create the .sock file

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.