nginxアップロードファイルサイズの制限client_を最適化max_body_size 8m;


セキュリティの最適化-アップロードファイルサイズの制限client_max_body_size 8m;
nginxサービスを設定すると、ユーザーが最大のアップロードデータサイズを許可されます.
ビジネスニーズに応じてアップロードファイルのサイズ制限を調整
パラメータの設定max_body_size 8m;
パラメータ構文client_max_body_sizeの具体的なサイズ値、デフォルト1 m;
配置場所http,server,location
nginx优化上传文件大小的限制client_max_body_size 8m;_第1张图片
 
メインプロファイルnginx.confでの構成
[root@web01 ~]# cat /application/nginx/conf/nginx.conf
worker_processes  2;
worker_cpu_affinity 0101 1010;
error_log logs/error.log;
 
#  Nginx worker         
worker_rlimit_nofile 65535;
 
user www www;
events {
    #               
    worker_connections  20480;
    #  epoll  
    use epoll;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    #sendfile        on;
    #keepalive_timeout  65;
    #      
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
 
 
    #    
    include /application/nginx/conf/extra/www.conf;
    include /application/nginx/conf/extra/blog.conf;
    include /application/nginx/conf/extra/bbs.conf;
    include /application/nginx/conf/extra/edu.conf;
    include /application/nginx/conf/extra/phpmyadmin.conf;
    include /application/nginx/conf/extra/status.conf;
 
    #nginx  ----------------------
    #     
    server_tokens on;
 
    #              
    server_names_hash_bucket_size 64;
    server_names_hash_max_size 2048;
 
    #          
    sendfile on;
    #         
    #tcp_nopush on;
    #  I/O  
    tcp_nodelay on;
 
    #                65 
    keepalive_timeout 60;
    
    #                      60 
    client_header_timeout 15;
    
    #                     60 
    client_body_timeout 15;
    
    #                 60 
    send_timeout 25;
 
    #             1m
    client_max_body_size 8m;
}