Try this documentation. https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
On Fri, Jul 26, 2019, 15:28 אורי <[email protected]> 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)/envmodule = 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/ -ls > 489 0 drwxr-xr-x 3 root root 60 Jul 20 08:41 > /run/uwsgi/ > 490 0 drwxr-xr-x 6 root root 120 Jul 20 <span > class="gmail-lit" > style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;v > > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGReadAs3%3DgQxWysM1_tQ0yuzbANzUzujuMbgqytQ8ygeofJYQ%40mail.gmail.com.

