configuration - NGINX client_max_body_size issue -


i have issue nginx client_max_body_size . getting issue

2017/09/11 13:21:02 [error] 6126#6126: *150091 client intended send large body: 1219514 bytes, client: 10.160.90.909, server: example.com, request: "post /api/sensors http/1.1", host: "example.com" .

getting 413 nginx error. want know should add(insert) client_max_body_size , recommended mb suggest..? please find nginx.conf file below

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 /etc/nginx/conf.d directory.     # see http://nginx.org/en/docs/ngx_core_module.html#include     # 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 static page /40x.html         #         error_page 404 /404.html;             location = /40x.html {         }         # redirect server error pages static page /50x.html         #         error_page 500 502 503 504 /50x.html;             location = /50x.html {         } } } 

you need insert inside @nodejs block. because upload being sent there. current failure indicates size of 1.16 mb.

so check maximum amount of data want/expect receive @ time. if expect 5mb max set 5.5mb or higher give cushion


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -