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/ -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 08:41 /run/uwsgi/app 500 0 drwxr-xr-x 2 ubuntu ubuntu 100 Jul 20 08:42 /run/uwsgi/app/speedy_net 523 0 -rw-rw-r-- 1 ubuntu ubuntu 0 Jul 20 08:43 /run/uwsgi/app/speedy_net/reload 501 0 srw-rw-rw- 1 ubuntu ubuntu 0 Jul 20 08:41 /run/uwsgi/app/speedy_net/socket 457 4 -rw-r--r-- 1 root root 5 Jul 20 08:41 /run/uwsgi/app/speedy_net/pid 498 0 drwxr-xr-x 2 ubuntu ubuntu 100 Jul 20 08:42 /run/uwsgi/app/speedy_match 524 0 -rw-rw-r-- 1 ubuntu ubuntu 0 Jul 20 08:43 /run/uwsgi/app/speedy_match/reload 499 0 srw-rw-rw- 1 ubuntu ubuntu 0 Jul 20 08:41 /run/uwsgi/app/speedy_match/socket 413 4 -rw-r--r-- 1 root root 5 Jul 20 08:41 /run/uwsgi/app/speedy_match/pid 495 0 drwxr-xr-x 2 ubuntu ubuntu 100 Jul 20 08:43 /run/uwsgi/app/speedy_mail 528 0 -rw-rw-r-- 1 ubuntu ubuntu 0 Jul 20 08:43 /run/uwsgi/app/speedy_mail/reload 497 0 srw-rw-rw- 1 ubuntu ubuntu 0 Jul 20 08:41 /run/uwsgi/app/speedy_mail/socket 496 4 -rw-r--r-- 1 root root 5 Jul 20 08:41 /run/uwsgi/app/speedy_mail/pid 491 0 drwxr-xr-x 2 ubuntu ubuntu 100 Jul 20 08:42 /run/uwsgi/app/speedy_composer 527 0 -rw-rw-r-- 1 ubuntu ubuntu 0 Jul 20 08:43 /run/uwsgi/app/speedy_composer/reload 494 0 srw-rw-rw- 1 ubuntu ubuntu 0 Jul 20 08:41 /run/uwsgi/app/speedy_composer/socket 493 4 -rw-r--r-- 1 root root 5 Jul 20 08:41 /run/uwsgi/app/speedy_composer/pid
The new server:
$ find /run/uwsgi/ -ls 554 0 drwxr-xr-x 3 root root 60 Jul 20 10:15 /run/uwsgi/ 555 0 drwxr-xr-x 6 root root 120 Jul 20 11:14 /run/uwsgi/app 573 0 drwxr-xr-x 2 ubuntu ubuntu 80 Jul 20 11:14 /run/uwsgi/app/speedy_net 598 0 srw-rw-rw- 1 ubuntu ubuntu 0 Jul 20 11:14 /run/uwsgi/app/speedy_net/socket 584 4 -rw-r--r-- 1 root root 5 Jul 20 11:14 /run/uwsgi/app/speedy_net/pid 568 0 drwxr-xr-x 2 ubuntu ubuntu 80 Jul 20 11:14 /run/uwsgi/app/speedy_match 572 0 srw-rw-rw- 1 ubuntu ubuntu 0 Jul 20 11:14 /run/uwsgi/app/speedy_match/socket 569 4 -rw-r--r-- 1 root root 5 Jul 20 11:14 /run/uwsgi/app/speedy_match/pid 565 0 drwxr-xr-x 2 ubuntu ubuntu 80 Jul 20 11:14 /run/uwsgi/app/speedy_mail 567 0 srw-rw-rw- 1 ubuntu ubuntu 0 Jul 20 11:14 /run/uwsgi/app/speedy_mail/socket 566 4 -rw-r--r-- 1 root root 5 Jul 20 11:14 /run/uwsgi/app/speedy_mail/pid 499 0 drwxr-xr-x 2 ubuntu ubuntu 80 Jul 20 11:14 /run/uwsgi/app/speedy_composer 564 0 srw-rw-rw- 1 ubuntu ubuntu 0 Jul 20 11:14 /run/uwsgi/app/speedy_composer/socket 561 4 -rw-r--r-- 1 root root 5 Jul 20 11:14 /run/uwsgi/app/speedy_composer/pid
The old server is
Ubuntu 16.04.6 LTS
, and the new server isUbuntu 18.04.2 LTS
.I also tried to ask on Stack Overflow but I didn't find a solution.
Any ideas?
אורי
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/CABD5YeEBFWgcT4mnCtduJFZsMQ6OERv%3DB8d%2BVw9bU5xURvKSoA%40mail.gmail.com.
Regards,
Aldian Fazrihady
http://aldianfazrihady.com
http://aldianfazrihady.com
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/CAN7EoAaaY9_qh_G5v0jLm-caDS8j88raKkmWWthvrPbkx4YvZw%40mail.gmail.com.
No comments:
Post a Comment