>  기사  >  운영 및 유지보수  >  nginx 구성 파일을 수정하여 업로드 파일 크기 제한 문제를 해결하세요.

nginx 구성 파일을 수정하여 업로드 파일 크기 제한 문제를 해결하세요.

王林
王林앞으로
2020-04-21 16:15:545758검색

nginx 구성 파일을 수정하여 업로드 파일 크기 제한 문제를 해결하세요.

문제 설명:

새 서버를 설치하고 nginx를 프록시로 사용했습니다. 갑자기 1M보다 큰 클라이언트 파일을 정상적으로 업로드할 수 없는 것을 발견하여 nginx 구성을 수정했습니다.

cd /export/servers/nginx/conf/nginx.conf

이 구성 파일의 서버 섹션에서

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

는 nginx를 다시 시작하는 방법에 관계없이 client_max_body_size 필드를 추가했습니다. 나중에 일반 구성 파일에서 하위 구성 파일이 발견되었습니다:

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;

include domains/* 명령은 하위 구성 파일의 경로를 지정합니다. 하위 구성 파일을 찾은 후 하위 구성 파일을 수정합니다. 하위 구성 파일 구성은 다음과 같습니다.

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

/export/servers/nginx/sbin/nginx -s reload로 다시 시작하면 업로드 파일 크기 제한 문제가 해결됩니다.

추천 튜토리얼: nginx 사용법 튜토리얼

위 내용은 nginx 구성 파일을 수정하여 업로드 파일 크기 제한 문제를 해결하세요.의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
이 기사는 csdn.net에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제