Home  >  Article  >  Operation and Maintenance  >  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

王林
王林forward
2020-04-21 16:15:545824browse

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

The client_max_body_size field is added to the

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

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;

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;
	}
}

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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete