Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save viewpnt1/0c7a48cb8b7f39df92bb28ee20360e54 to your computer and use it in GitHub Desktop.
Save viewpnt1/0c7a48cb8b7f39df92bb28ee20360e54 to your computer and use it in GitHub Desktop.

Revisions

  1. @luckydev luckydev revised this gist Nov 11, 2018. No changes.
  2. @luckydev luckydev revised this gist Nov 11, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -40,4 +40,5 @@ user@ubuntu:~$ ulimit -n
    # 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;

  3. @luckydev luckydev revised this gist Nov 11, 2018. 1 changed file with 7 additions and 8 deletions.
    15 changes: 7 additions & 8 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -19,14 +19,13 @@ user@ubuntu:~$ sudo sysctl -p
    user@ubuntu:~$ sudo vim /etc/security/limits.conf

    # add following lines to it
    * soft nproc 200000
    * hard nproc 200000
    * soft nofile 200000
    * hard nofile 200000
    root soft nproc 200000
    root hard nproc 200000
    root soft nofile 200000
    root hard nofile 200000

    * 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
  4. @luckydev luckydev created this gist Apr 12, 2017.
    44 changes: 44 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    # 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 nproc 200000
    * hard nproc 200000
    * soft nofile 200000
    * hard nofile 200000
    root soft nproc 200000
    root hard nproc 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;