【问题标题】:413 Request Entity Too Large nginx/1.14.0413 请求实体太大 nginx/1.14.0
【发布时间】:2019-12-13 15:15:23
【问题描述】:

当我从 localhost 上传图像时,我可以上传任何大小的图像,但是当我尝试通过服务器上传时,当图像大小大于 1Mb 时,它给了我请求实体太大的错误,我添加了这个 client_max_body_size 100M ;并重新启动 nginx,但问题仍然存在,有人知道出了什么问题 /var/www/abc/abc/nginx.config 路径在这里?

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 768;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript 
text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
client_max_body_size 100M;
}




<html>
<head>
    <title>413 Request Entity Too Large</title>
</head>
<body bgcolor="white">
    <center>
        <h1>413 Request Entity Too Large</h1>
    </center>
    <hr>
    <center>nginx/1.14.0 (Ubuntu)</center>
</body>
</html>

【问题讨论】:

  • 你试过upload_max_filesize = 100M、post_max_size = 100M吗?
  • 显然您编辑了错误的文件 (/etc/nginx/nginx.conf) 或格式不正确。请发布完整的配置文件并在您的问题中提及其路径。
  • 不,我不尝试这个
  • Xaqron 我如何编辑错误的文件?
  • 如果您不是从sites-available 到sites-enabled 的symlinking 配置文件,或者在配置文件中,例如不将配置键/val 放在正确的块中(即server)。

标签: node.js ubuntu nginx image-uploading


【解决方案1】:

一切都很好,只是 ngnix.conf 的路径错误,所以请确保在 nginx.conf 中添加此行时,请确保 ngnix.conf 位于正确的路径

【讨论】:

    猜你喜欢
    • 2015-01-25
    • 2017-08-28
    • 2016-04-30
    • 2016-05-27
    • 2016-08-27
    • 2021-06-29
    • 2019-09-02
    • 2021-11-13
    • 2016-02-01
    相关资源
    最近更新 更多