-
Star
(118)
You must be signed in to star a gist -
Fork
(55)
You must be signed in to fork a gist
-
-
Save luckydev/b2a6ebe793aeacf50ff15331fb3b519d to your computer and use it in GitHub Desktop.
# maximum capability of system | |
user@ubuntu:~$ cat /proc/sys/fs/file-max | |
708444 | |
# available limit | |
user@ubuntu:~$ ulimit -n | |
1024 | |
# To increase the available limit to say 200000 | |
user@ubuntu:~$ sudo vim /etc/sysctl.conf | |
# add the following line to it | |
fs.file-max = 200000 | |
# run this to refresh with new config | |
user@ubuntu:~$ sudo sysctl -p | |
# edit the following file | |
user@ubuntu:~$ sudo vim /etc/security/limits.conf | |
# add following lines to it | |
* soft nofile 200000 | |
* hard nofile 200000 | |
www-data soft nofile 200000 | |
www-data hard nofile 200000 | |
root soft nofile 200000 | |
root hard nofile 200000 | |
# edit the following file | |
user@ubuntu:~$ sudo vim /etc/pam.d/common-session | |
# add this line to it | |
session required pam_limits.so | |
# logout and login and try the following command | |
user@ubuntu:~$ ulimit -n | |
200000 | |
# now you can increase no.of.connections per Nginx worker | |
# in Nginx main config /etc/nginx/nginx.conf | |
worker_connections 200000; | |
worker_rlimit_nofile 200000; | |
Thanks!
Doesn't work for Ubuntu 18.04
same to me, did you change it?
@sleshJdev
One more point, if you use systemd, then need edit
/etc/systemd/system/nginx.service.d/nofile.conf
[Service]
LimitNOFILE=65536
Shouldn't L16 add the /etc/sysctl.conf
file?
user@ubuntu:~$ sudo sysctl -p
Doesn't work for Ubuntu 18.04
I just updated the gist by adding nginx config worker_rlimit_nofile
and followed all of the steps in Ubuntu 18.04. I could see the limit increase during the last ulimit -n
step.
Doesn't work for Ubuntu 18.04
It seems that on Ubuntu 18.04 one should set a separate limit for graphical login.
Checkout this topic for more info.
Cool, Thanks!
Must restart!
Change the maximum number of open files in ubuntu 18.10
Must restart! Change the maximum number of open files in ubuntu 18.10
not necessary. at least in 18.04
Cook, thank you