text 为Nginx增加Ubuntu 16.04中打开文件限制的最大数量

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 为Nginx增加Ubuntu 16.04中打开文件限制的最大数量相关的知识,希望对你有一定的参考价值。

# 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;

以上是关于text 为Nginx增加Ubuntu 16.04中打开文件限制的最大数量的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu16.04安装Nginx

Ubuntu16.04搭建web服务器运行WordPress

Ubuntu16.04安装及配置nginx

ubuntu 16.04 nginx 更改 phpmyadmin url 不起作用

Django,Nginx,Gunicorn。 Ubuntu 16.04 错误

Ubuntu16.04安装及配置nginx