无尽码路

清凉夏日,您升官了吗?
Nginx+PHP双重上传限制,很耽误吃饭
at 2022-11-26 15:50:36, by 鹏城奋青

上传文件老失败,而且没有收到明显提示,务必看一看这两处设置。

1、Nginx反向代理有转发的Request Body有大小限制。

server {
		listen 80;
		server_name localhost;
		root d:/workspace/wisforce/pcfq/web;
		index index.php index.html;
		client_max_body_size 200m; #注意这个限制
		
		location ~ \.(css|js) {
			add_header Cache-Control no-store;add_header Pragma no-cache;
		}
		
		location ~ \.php$ {
			fastcgi_pass 127.0.0.1:9000;
			include fastcgi.conf;
		}
		
		location / {
			try_files $uri $uri/ index.php?$args;
		}
	}

2、php.ini自然也是有文件大小限制。

;这两项
post_max_size = 2G
upload_max_filesize = 2G