Set/increase max file upload and post size in PHP Nginx; Through this tutorial, you will learn how to increase/set max file upload size in PHP Nginx.
How to Increase Max File Upload size in PHPMyAdmin in PHP Nginx
Use the below-given steps to set or increase file upload size in NGINX. For set/increasing max file size upload in PHP Nginx will use the client_max_body_size directive to set the NGINX max file upload size limit. So, i will add client_max_body_size directive in http, server or location; is as follow:
- Step 1 – Open NGINX configuration file
- Step 2 – Increase File Upload Size in NGINX
- Step 3 – Restart NGINX
Step 1 – Open NGINX configuration file
Execute the following command on the terminal to open the NGINX configuration file in a text editor.
$ sudo /etc/nginx/nginx.conf
Step 2 – Increase File Upload Size in NGINX
Now, increase file upload size to 100MB across your entire site. So edit the line client_max_body_size 100M: as follows:
http{ ... client_max_body_size 100M; ... }
To increase file size upload limit only for HTTPS requests but not HTTP requests. In that situation, the line client_max_body_size 100M to server block that listens to HTTPS port 443 but not the server block that listens to port 80.
server{ listen 80; ... } server{ listen 443; ... }
You can also use the above technique, if you want to set file upload size only for a specific website/domain/subdomain/app.
In that, you can add the line client_max_body_size 100M. Let’s say you want to increase file upload size for /uploads folder
location /uploads { ... client_max_body_size 100M; }
Step 3 – Restart NGINX
Execute the following command on the terminal to restart Nginx:
$ sudo nginx -t
If there are no errors, execute the following command on terminal to restart NGINX server.
$ sudo service nginx reload #debian/ubuntu $ systemctl restart nginx #redhat/centos
Conclusion
That’s it! Through this tutorial, you have learned how to set/increase the file upload size limit in NGINX.