Friday, July 26, 2019

Re: Problem with running Django with nginx and uwsgi in Ubuntu

Thanks Aldian,

The community have reached out to me with thoughts, as well as guidance, I.e. django for girls, django forums and github 


These resources have made a significant  difference, things are working and I'm slowly learning.
the community are welcoming, knowledgable, helpful and patient, espevialk  to us 'newbs' who have no programming experience. 

Big Thank you to the django and python community, it is valued. 

Best,

Kean 







On Fri, 26 Jul 2019 at 22:34, Aldian Fazrihady <mobile@aldian.net> wrote:
Try increasing client_max_body_size. For example, ```client_max_body_size 75M```


‪On Fri, Jul 26, 2019 at 7:28 PM ‫אורי‬‎ <uri@speedy.net> wrote:‬
Django users,

I'm trying to install a new server, and I can't run Django with nginx and uwsgi. I receive an error "502 Bad Gateway" and there are messages on the error log which I don't understand:

2019/07/20 10:50:44 [error] 2590#2590: *1 upstream prematurely closed connection while reading response header from upstream, client: 79.183.208.33, server: *.speedy.net.3.speedy-technologies.com, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:/run/uwsgi/app/speedy_net/socket:", host: "3.speedy-technologies.com"

I have 4 websites and here is the main (default) configuration file:

server {      listen [::]:80 default_server;      listen 80 default_server;      server_name *.speedy.net.3.speedy-technologies.com speedy.net.3.speedy-technologies.com;        access_log /var/log/nginx/speedy-net.access.log;      error_log /var/log/nginx/speedy-net.error.log;        client_max_body_size 50M;        root  /home/ubuntu/speedy-net/speedy/net/static_serve/root;      try_files $uri @uwsgi;        location @uwsgi {          include uwsgi_params;          uwsgi_pass unix:/run/uwsgi/app/speedy_net/socket;      }        location /admin/ {          auth_basic "admin site";          auth_basic_user_file /etc/nginx/htpasswd_admin;          include uwsgi_params;          uwsgi_pass unix:/run/uwsgi/app/speedy_net/socket;      }        location /static {          alias /home/ubuntu/speedy-net/speedy/net/static_serve;          access_log off;          # expires max;          gzip on;          gzip_min_length 1100;          gzip_buffers 4 32k;          gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml  application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;          gzip_vary on;          gzip_comp_level 6;      }  }

And:

[uwsgi]  project = net    chdir = /home/ubuntu/speedy-net  home = %(chdir)/env  module = speedy.%(project).wsgi:application    plugins = python3  master = true  processes = 4    chmod-socket = 666  vacuum = true    uid = ubuntu  gid = ubuntu    touch-reload = /run/uwsgi/app/speedy_%(project)/reload

I tried to test with sudo nginx -t but I received a message that my configuration is OK. What is the problem?

Edit:

The old server (which is working):

$ find /run/uwsgi/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKvrVZPTEbU-EtcLF%2BuzEzxR6_gVMAkAhnLYW6jYQMdnH_r8Eg%40mail.gmail.com.

No comments:

Post a Comment