2017-09-11 4 views
0

nginx client_max_body_sizeに関する問題があります。 1219514バイト、クライアント:10.160.90.909、サーバーが大きすぎる体を送信するためのもの* 150091クライアント:私はNGINX client_max_body_size issue

のような問題が2017年9月11日午後01時21分02秒に[エラー] 6126#6126を取得していますexample.com、リクエスト: "POST/api/sensors HTTP/1.1"、ホスト: "example.com"

413 nginxエラーが発生しました。私はclient_max_body_sizeをどこに追加すればいいのか知りたいのですが、お勧めのMBは何ですか?あなたの@nodejsブロック内に挿入する必要が

user nginx; 
worker_processes auto; 
error_log /var/log/nginx/error.log; 
pid /var/run/nginx.pid; 
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 
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; 
    keepalive_timeout 65; 
    types_hash_max_size 2048; 
    include    /etc/nginx/mime.types; 
    default_type  application/octet-stream; 
    # Load modular configuration files from the /etc/nginx/conf.d directory. 
    # See http://nginx.org/en/docs/ngx_core_module.html#include 
    # for more information. 
    index index.html index.htm; 
upstream nodejs { 
    server localhost:3000; 
} 
    server { 
     listen  80; 
     server_name example.com; 

location/{ 
if ($http_x_forwarded_proto != 'https') { 
      return 301 https://$server_name$request_uri; 
     } 
     try_files $uri $uri/ @nodejs; 
    } 

    location @nodejs { 
     proxy_redirect off; 
     proxy_http_version 1.1; 
     proxy_pass http://nodejs; 
     proxy_set_header Host $host ; 
     proxy_set_header X-Real-IP $remote_addr; 
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    } 
location ~ (/images|/img|/javascript|/js|/css|/stylesheets|/flash|/media|/static|robots.txt|humans.txt|favicon.ico){ 
root /var/www/dev/public; 
} 
     # redirect server error pages to the static page /40x.html 
     # 
     error_page 404 /404.html; 
      location = /40x.html { 
     } 
     # redirect server error pages to the static page /50x.html 
     # 
     error_page 500 502 503 504 /50x.html; 
      location = /50x.html { 
     } 
} 
} 
+0

おそらくこれが役立ちます:https://stackoverflow.com/questions/2056124/nginx-client-max-body-size -has-no-effect – user3486184

答えて

0

以下の私のnginx.confファイルを見つけてください。アップロードがそこに送られているので。現在の障害は1.16 MBのサイズを示します。

一度に受信する予定のデータの最大量を確認してください。したがって、これを最大5MBにすると5.5MB以上に設定してください。