Django deployed on nginx card on socket

problem summary: novice programmers intend to write a simple project to display data in Ubuntu16.04,Python3.5,Django2.0, only one App, test is correct, and intend to deploy in NGINX+uWSGI. But there was a problem during the test.

paste the code first

    The
  1. project is written under / var/www/, and the name onco, establishes an app as current.
  2. setting is like this (in addition to the database, App has been changed, something about static files has been added below):
import os

DEBUG = False
ALLOWED_HOSTS = ["*"]
INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "myapp",
]
...
STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
  1. during the deployment of uWSGI, the test.py used for testing is
-sharp!/usr/bin/python

def application(env, start_response):
    start_response("200 OK", [("Content_Type", "text/html")])
    return [b"Congraduation!!! uWSGI Testing OK!!!"]

pass the uwsgi-- http: 8001-- wsgi-file test test, and pass the uwsgi-- http: 8001-/ var/www/onco-- module onco.wsgi test when testing the project.

  1. install Nginx. The nginx welcome interface appears after access to port 80.
  2. configure Nginx. Myconfig: is established under the project directory
upstream django {
        server 127.0.0.1:9002; 
    }
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location /static/ {
        alias /var/www/onco/currenct/static/;
    }

    location / {
        root /var/www/onco; -sharp
        uwsgi_pass django;
        include /var/www/onco/uwsgi_params; -sharpuwsgi_params
    }
}
The

uwsgi_params file is also written in this directory.

  1. when the test runs uwsgi-- socket: 9002-- wsgi-file test, run log:
*** Starting uWSGI 2.0.17.1 (64bit) on [Tue Jul 31 13:10:36 2018] ***
compiled with version: 5.4.0 20160609 on 30 July 2018 04:21:16
os: Linux-4.13.0-36-generic -sharp40~16.04.1-Ubuntu SMP Fri Feb 16 23:25:58 UTC 2018
nodename: ubuntu
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /var/www/onco
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 3768
your memory page size is 4096 bytes
detected max file descriptor number: 65535
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :9002 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Python version: 3.5.2 (default, Nov 23 2017, 16:37:01)  [GCC 5.4.0 20160609]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x1569890
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72904 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint="") ready in 0 seconds on interpreter 0x1569890 pid: 12160 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options

Web prompt after visiting the interface

192.168.0.105 
ERR_EMPTY_RESPONSE

background prompt invalid request block size: 21573 (max 4096) .skip . The
tutorial tells me to increase buffer, so I use uwsgi-- socket: 8011-- wsgi-file test.py-- buffer-size 32768 to run, and still get:

192.168.0.105 
ERR_EMPTY_RESPONSE

but this time the background prompt becomes
uwsgi_proto_uwsgi_parser (): Success [proto/uwsgi.c line 40]

so the test nginx has not been able to proceed. The online tutorial says that because I didn"t use socket, I don"t know where the configuration was wrong, so that nginx and uwsgi have been unable to communicate

.

Please do not hesitate to comment

Aug.11,2021

I replace socket:9002 with http-socket:9002, plus.
forget it. Post my uwsgi.ini
[uwsgi]
http-socket =: 9000
master = true
enable-threads = true
chdir = / home/proj-sharp
module = proj.wsgi
uwsgi_read_timeout = 600
harakiri = 1200
buffer-size = 32768
processes = 4
threads = 4
chmod-socket = 664
vacuum = true

< H1 > logto = uwsgi.log < / H1 >

limit-as = 6048
plugin=python35

< H1 > pythonpath = / home/proj < / H1 >

socket=/home/proj/log/uwsgi.sock

this is nginx. Conf Local

upstream serverproj {
    server unix:///home/proj/log/uwsgi.sock;-sharpfile socket
}

server {

location / {

    uwsgi_send_timeout  600;
    uwsgi_connect_timeout  600;
    uwsgi_read_timeout  2100;
    uwsgi_param UWSGI_CHDIR /home/proj/;
    uwsgi_param UWSGI_SCRIPT proj.wsgi;
        uwsgi_pass serverproj;    
    include /home/proj/uwsgi_params;
    
    }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaa0bf-1fa5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaa0bf-1fa5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?