Fix File Upload on Nginx

Nginx (Engine-X) is a Web server and reverse proxy server for HTTP, SMTP, POP3 and IMAP, It have a strong focus on high concurrency, performance and low memory usage.

Here are the steps to fix file upload on nginx.

Fix File Upload on Nginx

1. SSH to nginx box

2. Edit nginx.conf

a) backup the config file:
# cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.backup
b) edit the config file:
# vi /etc/nginx/nginx.conf
c) add a row inside the “location / {” section (I added it after the error_page rows):
client_max_body_size 100M;
d) save the config file
e) test the config file syntax:
# nginx -t -c /etc/nginx/nginx.conf

3. If config file is good, then reload nginx config without restarting it

f) find the nginx master process PID:
# ps aux | egrep ‘(PID|nginx)’
g) reload nginx by sending the HUP signal (replace 1234 with actual PID of master process)
# kill -HUP 1234

nginx.conf