Home > System Tutorial > LINUX > Tutorial on setting up nginx+php to upload large files

Tutorial on setting up nginx+php to upload large files

王林
Release: 2024-04-24 08:46:01
forward
1051 people have browsed it

Tutorial on setting up nginx+php to upload large files

To allow PHP to upload large files, you usually need to modify the configuration file php.ini, as follows
file_uploads = on ; //是否允许通过HTTP上传文件的开关,默认为ON
upload_tmp_dir ;    //文件上传到服务器临时摆放的目录
upload_max_filesize=2m; //允许上传文件大小的最大值
post_max_size = 8m ;    //指通过表单POST给PHP的所能接收的最大值,包括表单里的所有值。
max_execution_time=600; //每个PHP页面运行的最大时间值(秒),默认30秒
max_input_time = 600;   //每个PHP页面接收数据所需的最大时间,默认60秒
memory_limit = 8m ; //每个PHP页面所吃掉的最大内存,以前的机制一般默认8M,现在基本都是128m
Copy after login
After php is configured, nginx still cannot upload large files without corresponding configuration, and will prompt
413 Request Entity Too Large
Copy after login

You need to open nginx.conf and add the following parameters in the http{} configuration:

client_max_body_size 50m; //最大能上传50m大小的文件。
Copy after login

The above is the detailed content of Tutorial on setting up nginx+php to upload large files. For more information, please follow other related articles on the PHP Chinese website!

source:linuxprobe.com
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