Home | Mirror | Search

3. limits.conf

临时设置

ulimit -HSn 65536
ulimit -HSm 65536
		
echo "ulimit -SHn 65530" >> /root/.bash_profile
echo "ulimit -SHm 16000000" >> /root/.bash_profile
echo "ulimit -HSn 65536" >>/root/.bash_profile
		

使用“*”作用于所有用户,但见这样设置,最好的方式是针对需要的用户个别设置

		
echo -ne "
* soft nofile 65536
* hard nofile 65536
" >>/etc/security/limits.conf > /dev/null 2>&1
		
		

/etc/security/limits.d

		
cat >> /etc/security/limits.conf <<EOF
root 	soft nofile 10240
root 	hard nofile 65536
nobody 	soft nofile 10240
nobody 	hard nofile 65536
EOF
		
		

		
cat >> /etc/security/limits.conf <<EOF
www 	soft nofile 65536
www 	hard nofile 65536
EOF
		
		

		
cat >> /etc/security/limits.conf <<EOF
apache 	soft nofile 65536
apache 	hard nofile 65536
EOF
		
		

		
cat >> /etc/security/limits.conf <<EOF
nginx 	soft nofile 65536
nginx 	hard nofile 65536
EOF
		
		

		
cat >> /etc/security/limits.conf <<EOF
mysql 	soft nofile 65536
mysql 	hard nofile 65536
EOF
		
		
comments powered by Disqus