标签:keepaliv nginx dev user 优化 查看进程 文件 security trie
#查看文件句柄数设置
[root@web01 ~]# ulimit -n
65535
#查看总共打开的文件句柄数
[root@web01 ~]# lsof | wc -l
#查看进程打开的文件句柄数
[root@web01 ~]# lsof -p 71336 | wc -l
[root@web01 ~]# vim /etc/security/limits.conf
* - nofile 65535
* soft nofile 65535
* hard nofile 65535
* #代表所有用户
- #超过文件句柄数时,什么都不干
soft #超过文件句柄数时,仅提示
hard #超过文件句柄数时,直接限制
[root@web01 ~]# vim /etc/security/limits.conf
root - nofile 65535
root soft nofile 65535
root hard nofile 65535
[root@web01 ~]# vim /etc/nginx/nginx.conf
user www;
worker_processes 1;
worker_rlimit_nofile 65535;
[root@web01 ~]# vim /etc/sysctl.conf
net.ipv4.tcp_fin_timeout = 2
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_keepalive_time = 600
net.ipv4.ip_local_port_range = 4000 65000
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_max_tw_buckets = 36000
net.ipv4.route.gc_timeout = 100
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_synack_retries = 1
net.core.somaxconn = 16384
net.core.netdev_max_backlog = 16384
net.ipv4.tcp_max_orphans = 16384
net.ipv4.ip_forward = 1
[root@web01 ~]# sysctl -p #生效
标签:keepaliv nginx dev user 优化 查看进程 文件 security trie
原文地址:https://www.cnblogs.com/chenlifan/p/13651933.html