当遇到 413 Request Entity Too Large(请求实体太大)

可以修改 nginx.conf 配置文件下的 http 模块
修改如下


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #error_log /dev/stderr notice;
    #access_log /dev/stdout main_timed;

    charset utf-8;
    sendfile    on;
    tcp_nopush  on;
    tcp_nodelay on;
    server_tokens off;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    client_max_body_size 50m;      // 添加这一条
    client_body_temp_path /tmp/client_temp;
    proxy_temp_path /tmp/proxy_temp_path;
    fastcgi_temp_path /tmp/fastcgi_temp;
    uwsgi_temp_path /tmp/uwsgi_temp;
    scgi_temp_path /tmp/scgi_temp;

    gzip  on;
    gzip_vary on;
    gzip_min_length 1024;
    gzip_buffers 16 8k;
    gzip_comp_level 3;
    gzip_types text/plain application/x-javascript text/css application/xml image/jpeg image/gif image/png;
    gzip_disable "MSIE 6\.";

    include /etc/nginx/conf.d/*.conf;
}
最后修改:2023 年 02 月 06 日 05 : 11 PM
如果觉得我的文章对你有用,请随意赞赏