Modify the configuration to resolve common upload and connection errors in the Nginx server

  • 2020-05-10 23:30:16
  • OfStack

nginx upload error 413 Request Entity Too Large
By default, if you use nginx reverse agent to upload files over 2MB, you will report an error of 413 Request Entity Too Large. To solve this problem, you can simply modify the configuration client_max_body_size value
Modify nginx conf


#cat /usr/local/nginx-1.7.0/conf/nginx.conf | grep client_max_body_size
 client_max_body_size 10M;

If you need to upload a larger file, you can change client_max_body_size to a larger value, and here you can change it to 10MB
Restart nginx


 # /usr/local/nginx-1.7.0/sbin/nginx -s reload


connect() failed (111: Connection refused) while connecting to upstream
Sometimes nginx works fine, but you can still find errors in the error log: connect() failed (111: Connection refused) while connecting to upstream.
1 generally, our upstream is fastcgi://127.0.0.1:9000. There are two reasons for this problem
  1. php-fpm is not running
Execute the following command to see if php-fpm is enabled. If not, launch your php-fpm


netstat -ant | grep 9000

 
2. The php-fpm queue is full
Modify the php-fpm.conf configuration file pm.max_children by 1 point, restart php-fpm and observe the log



Related articles: