Last active
November 1, 2017 08:39
-
-
Save binhqd/f35a0cfafe876884466ad5ce2f91fdf5 to your computer and use it in GitHub Desktop.
Enable OS max connections and ports
This file contains 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
# Check number of CPUs | |
grep ^processor /proc/cpuinfo | wc -l | |
# set maximum number of open files (current session) | |
ulimit -u 10000 | |
ulimit -n 10000 | |
# Modify number open files | |
vi /etc/security/limits.conf | |
# * soft nofile 64000 | |
# * hard nofile 64000 | |
# root soft nofile 64000 | |
# root hard nofile 64000 | |
# Max file size | |
vi /etc/sysctl.conf | |
fs.file-max = 2097152 | |
# Enable session limits | |
vi /etc/pam.d/common-session | |
# session required pam_limits.so | |
vi /etc/pam.d/common-session-noninteractive | |
# restart | |
sysctl -p | |
echo 6400 64000 > /proc/sys/net/ipv4/ip_local_port_range | |
sudo -u nginx bash -c "ulimit -a" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment