简体   繁体   English

Django nginx 413 请求实体太大

[英]Django nginx 413 Request Entity Too Large

After logining the admin page it is returning 413 error (Request Entity Too Large).登录管理页面后返回 413 错误(请求实体太大)。 Than I added client_max_body_size to my /etc/nginx/nginx.conf and restarted nginx, but it didnt helped:( I know that this error is a common one, but I had to ask this question because there is no more information that about client_max_body_size.比我将client_max_body_size添加到我的/etc/nginx/nginx.conf并重新启动nginx,但它没有帮助:(我知道这个错误很常见,但我不得不问这个问题,因为没有更多关于client_max_body_size的信息.

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    types_hash_max_size 2048;
    # server_tokens off;
    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    client_max_body_size 100;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}


#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
#
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
#}

Add this in your settings.py file将此添加到您的 settings.py 文件中

DATA_UPLOAD_MAX_MEMORY_SIZE = 5242880 # 5 MB

if this doesn't work, in your nginx.config file try如果这不起作用,请在您的 nginx.config 文件中尝试

client_max_body_size 100;

to this:对此:

 client_max_body_size 200M;

you can refer this你可以参考这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 413 请求实体太大 nginx django - 413 Request Entity Too Large nginx django Django SQSError:413请求实体太大 - Django SQSError: 413 Request Entity Too Large Django:Ajax上载包含文件的Formdata时出现413(请求实体太大)错误 - Django: 413 (request entity too large) error upon ajax upload of Formdata containing files zappa为多个图像的Django表单提供了413请求实体太大的错误 - zappa giving 413 request entity too large error for Django form with mutiple images 如何修复数字海洋 django 应用程序上的“413 请求实体太大” - How to fix a “413 request entity too large” on digital ocean-django app 到服务器的AJAX POST导致错误413:请求实体太大 - AJAX POST to server results in Error 413: Request Entity Too Large 413 请求实体太大 - 常规修复不起作用 - 413 Request Entity Too Large - Regular Fix Not Working 将带有后期处理请求的文件发送到dotcloud时出现错误:413请求实体太大 - When sending a file with a post request to dotcloud I get error: 413 Request Entity Too Large 413 Django 服务器上的负载过大 - 413 Payload Too Large on Django server 在Nginx服务器Rhel上部署Django应用-400错误的请求请求标头或cookie太大 - Deploying django application on nginx server rhel - 400 bad request Request Header or cookie too large
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM