413请求实体太大nginx / 1.14.0

时间:2019-08-06 06:00:40

标签: node.js ubuntu nginx image-uploading

当我从本地主机上载图像时,我可以上载任何大小的图像,但是当我尝试通过服务器上载时,当图像大小大于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>

1 个答案:

答案 0 :(得分:1)

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

相关问题