Changing max open file limit / maximum number of open files in Ubuntu Server 12.04 LTS

How to change max open file limit / maximum number of open files in Ubuntu Server 12.04 LTS

This issue has plague me for a long time, and everytime I try to solve it, I Google for hours, tried all the solutions, did 50 reboots and NADA!  Very frustrating....

What is the problem?
"Too many open files"
"Exceeded maximum number of opened files"
etc...

But today I got lucky and SOLVED the problem, so I would like to share.

NOTE: This is specifically for Ubuntu Server. I just tried it on 12.04 LTS and it works. I am sure this works on 10.04 LTS also.


nano /etc/sysctl.conf

Add the following:

fs.file-max = 204708


nano /etc/pam.d/limits.conf

Add the following:

root soft nofile 65536
root hard nofile 65536

www-data soft nofile 65536
www-data hard nofile 65536


nano /etc/pam.d/su

Un-remark the following line:

session    required   pam_limits.so


nano /etc/pam.d/common-session

Add the following line:

session    required   pam_limits.so



nano /etc/pam.d/common-session-noninteractive

Add the following line:

session    required   pam_limits.so


reboot


Now check if limit has been changed

ulimit -a



Post a Comment

Mới hơn Cũ hơn