Home > Operation and Maintenance > Nginx > Solve the upload file size limit problem by modifying the nginx configuration file

Solve the upload file size limit problem by modifying the nginx configuration file

王林
Release: 2020-04-21 16:15:54
forward
5871 people have browsed it

Solve the upload file size limit problem by modifying the nginx configuration file

Problem description:

A new server was installed and nginx was used as a proxy. Suddenly I found that client files larger than 1M could not be uploaded normally, so I modified the nginx configuration.

cd /export/servers/nginx/conf/nginx.conf
Copy after login

The client_max_body_size field is added to the

location / {
            root   html;            
            index  index.html index.htm;
            client_max_body_size    1000m;
  }
Copy after login

in the server section of this configuration file. No matter how to restart nginx, it will not work. Later, the sub-configuration file was found in the general configuration file:

sendfile        on;
#tcp_nopush     on;
		
#keepalive_timeout  0;
keepalive_timeout  65;
		  
#gzip  on;
include domains/*;  #########################分配置文件路径在此
#include domains/chat.local;
#include domains/chat.erp.com;
#include domains/support.chat.com;
#include douains/chat.com;

server {
	listen       80; 
	server_name  localhost;
Copy after login

The include domains/* command specifies the path to the sub-configuration file. After finding the sub-configuration file, make modifications in the sub-configuration file. The sub-configuration file configuration is as follows:

server
{
	listen   80;
	server_name  chat.erp.360buy.com;
	#access_log    /export/servers/nginx/logs/chat.erp.360buy.com;
	location / {
		proxy_pass     http://tomcat;
		client_max_body_size    1000m;
	}
}
Copy after login

Restart with /export/servers/nginx/sbin/nginx -s reload, and the problem of limited upload file size will be solved.

Recommended tutorial: nginx usage tutorial

The above is the detailed content of Solve the upload file size limit problem by modifying the nginx configuration file. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template