최대 단일 파일의 nginx를 제한 할 수있는 클라이언트의 요청 추가

nginx.conf에 다음을 추가합니다.

10m을 client_max_body_size # 단일 파일이 클라이언트에 의해 요구되는 최대 바이트 수 있도록
클라이언트 프록시 캐시 버퍼 # 1 바이트 요청> 요청의 최대 수; client_body_buffer_size의 128K

모든 구성 :

/usr/share/nginx/modules/*.conf 포함한다;
사용자의 nginx;
자동 worker_processes;
의 error_log /var/log/nginx/error.log;
PID는 /run/nginx.pid;
이벤트 {
worker_connections 1024;
}

HTTP {
log_format 주 '$ REMOTE_ADDR - \ (REMOTE_USER [\) time_local] " \ (요청"' '\) 상태 \ (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;
client_max_body_size 10m; #允许客户端请求的最大单文件字节数
client_body_buffer_size 128k; #缓冲区代理缓冲用户端请求的最大字节数

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.
include /etc/nginx/conf.d/*.conf;

server {
    listen        12345 default_server;
    listen       [::]:12345 default_server;
    server_name  _;
    root         /usr/share/nginx/html;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
    }

    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }
}

추천

출처www.cnblogs.com/daixh/p/12064593.html