#设置工作进程的最大打开文件数为65536 [root@centos7 ~]#vim /apps/nginx/conf/nginx.conf worker_rlimit_nofile 65536; [root@centos7 ~]#ulimit -n 100000 [root@centos7 ~]#ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 7835 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 100000 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 7835 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited #修改PAM资源限制 [root@centos7 ~]#vim /etc/security/limits.conf * soft core unlimited * hard core unlimited * soft nproc 1000000 * hard nproc 1000000 * soft nofile 1000000 * hard nofile 1000000 * soft memlock 32000 * hard memlock 32000 * soft msgqueue 8192000 * hard msgqueue 8192000 #重启生效 [root@centos7 ~]#reboot [root@centos7 ~]#ulimit -n 1000000 [root@centos7 ~]#ulimit -a core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 7835 max locked memory (kbytes, -l) 32000 max memory size (kbytes, -m) unlimited open files (-n) 1000000 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 8192000 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 1000000 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited



