nginx上傳錯誤413 Request Entity Too Large
默認情況下使用nginx反向代理上傳超過2MB的文件,會報錯413 Request Entity Too Large,解決這個方法很簡單,修改配置client_max_body_size值即可
修改nginx.conf
#cat /usr/local/nginx-1.7.0/conf/nginx.conf | grep client_max_body_size client_max_body_size 10M;
如果需要上傳更大的文件,那么client_max_body_size改成更大的值即可,這邊改成了10MB
重啟nginx
# /usr/local/nginx-1.7.0/sbin/nginx -s reload
connect() failed (111: Connection refused) while connecting to upstream解決
有時候nginx運行很正常,但是會發現錯誤日志中依舊有報錯connect() failed (111: Connection refused) while connecting to upstream.
一般情況下我們的upstream都是fastcgi://127.0.0.1:9000. 造成這個問題的原因大致有兩個
1.php-fpm沒有運行
執行如下命令查看是否啟動了php-fpm,如果沒有則啟動你的php-fpm即可
netstat -ant | grep 9000
2.php-fpm隊列滿了
php-fpm.conf配置文件pm.max_children修改大一點,重啟php-fpm并觀察日志情況