服務器架構是:Nginx+uWSGI+Django
某一天,發現服務器返回的response不完整,例如文檔大小是200K的,但是只返回了100K給瀏覽器。
查了一下uWSGI的日志,發現以下錯誤:
Mon May 16 18:01:02 2016 - uwsgi_response_write_body_do(): Connection reset by peer [core/writer.c line 322] during GET /access?gid=5&action=edit&rand=20160516180050335056 (192.168.5.205)
IOError: write error
同時查一下Nginx的錯誤日志,發現:
mkdir() "/usr/local/nginx/uwsgi_temp/3/25" failed (13: Permission denied)
看來是因為Nginx沒有權限操作目錄/usr/local/nginx/uwsgi_temp/3/25
解決:
修改目錄的擁有者為啟動Nginx進程的用戶
chown -R www /usr/local/nginx/uwsgi_temp