-
-
Save lapngodoan/34d893815eec3d453f5b to your computer and use it in GitHub Desktop.
failed (104: Connection reset by peer) while reading response header from upstream, client:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
failed (104: Connection reset by peer) while reading response header from upstream, client: | |
If you are getting the above error in nginx logs running in from of upstream servers you may consider doing this as it worked for me: | |
check the ulimit on the machines and ensure it is high enough to handle the load coming in. 'ulimit' on linux, I am told determines the maximum number of open files the kernel can handle. | |
The way I did that? | |
modifying limits: for open files: | |
-------------------------------- | |
add or change this line in /etc/systcl.conf | |
fs.file-max = <limit-number> | |
set soft & hard limits in this file for various users: /etc/security/limits.conf | |
<user-name or group-name or *> soft nofile <limit-number> | |
<user-name or group-name or *> soft nofile <limit-number> hard nofile <limit-number> | |
Then reload the system settings withou restarting: | |
sysctl -p | |
nginx settings : | |
-------------------------------- | |
in nginx.conf add/set: | |
worker_rlimit_nofile <limit-number> | |
When setting up upstream servers or not, it is a good idea to keep some connections alive when running on HTTP 1.1. Consider adding this to the upstream block on : | |
keepalive <some-number>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment