首页

关于在nginx的nginx.conf和tomcat的server.xml上传文件大小限制20M配置示例

标签:tomcat,nginx,server.xml,nginx.conf,上传文件,大小限制,maxPostSize,client_max_body_size     发布时间:2017-08-18   

一、关于在tomcat在server.xml的配置文件上传大小20M的限制 - maxPostSize="20971520"

<Connector port="8080" protocol="HTTP/1.1"@b@                           maxThreads="200" @b@                           minSpareThreads="25" @b@                           maxSpareThreads="100"@b@                           acceptCount="200"@b@                           maxPostSize="20971520"@b@                           connectionTimeout="30000"@b@                           enableLookups="false"@b@                           disableUploadTimeout="true"@b@                           compression="on"@b@                           compressableMimeType="text/html,text/xml,text/plain,text/css,@b@                           text/javascript,text/json,application/x-javascript,@b@                           application/javascript,application/json"@b@                       noCompressionUserAgents="gozilla, traviata"@b@               redirectPort="8443" />

二、在nginx的nginx.conf的配置文件上传大小为20M - client_max_body_size   20m;

location /gw/file/upload {@b@            proxy_pass http://127.0.0.1/upload;@b@            proxy_redirect  off;@b@            proxy_set_header        Host    $http_host;@b@            proxy_set_header        X-Real-IP       $remote_addr;@b@            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;@b@            proxy_set_header   Cookie $http_cookie;@b@            client_max_body_size   20m;@b@}
<<热门下载>>