我已经使用nginx和gunicorn在centos 7上部署了django应用,当我尝试上传25MB的大文件时,上传80-90%后它变得挂起,我经历了许多解决方案并更改了nginx。 conf文件相应,但没有任何效果。 我在nginx日志文件中没有收到任何错误或与之相关的日志,客户端也没有从服务器获得任何响应。
我没有出什么问题,请为此提供帮助。
-gunicorn.service
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=prod
Group=nginx
WorkingDirectory=/home/prod/myProject1.0/myProject
ExecStart=/home/prod/myProjectenv/bin/gunicorn --workers 3 --bind unix:/home/prod/myProject1.0/myProject/myProject.sock myProject.wsgi:application
[Install]
WantedBy=multi-user.target
-nginx.conf
user prod;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
server_name _;
client_body_in_file_only clean;
client_max_body_size 8000M;
client_body_buffer_size 80k;
client_body_timeout 300s;
client_body_temp_path /home/prod/media;
send_timeout 300s;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
autoindex on;
alias /home/prod/myProject1.0/myProject/static/;
}
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://unix:/home/prod/myProject1.0/myProject/myProject.sock;
}
}
}
我的项目文件夹结构-
drwxrwxr-x. 4 prod prod 55 Nov 13 12:37 myProject1.0
drwxrwxr-x. 5 prod prod 56 Nov 13 13:12 myProjectenv
drwx------. 2 prod nginx 6 Nov 26 15:18 media
-rw-rw-r--. 1 prod prod 944 Nov 14 13:57 mynginx.pp
-rw-rw-r--. 1 prod prod 223 Nov 14 13:57 mynginx.te
-rw-rw-r--. 1 prod prod 30388 Oct 4 07:31 mysql80-community-release-el8.rpm
-rw-rw-r--. 1 prod prod 20753760 Mar 18 2019 Python-3.5.7.tgz
drwxrwxr-x. 2 prod prod 107 Nov 11 18:57 rpm