Through this tutorial, you will learn how to increase/set max file upload size in PHP Nginx.
How to Increase Max Upload size in PHPMyAdmin in Nginx?
Here are steps:
- Step 1 – Open NGINX configuration file
- Step 2 – Increase File Upload Size in NGINX
- Step 3 – Restart NGINX
Step 1 – Open NGINX configuration file
Run 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 the file upload size to 100MB across your entire site. To 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.