我有一个CentOS 6.4服务器,当我运行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) 92905 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 65536 cpu time (seconds, -t) unlimited max user processes (-u) 1024 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
当我从Apache的用户运行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) 92905 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 32768 cpu time (seconds, -t) unlimited max user processes (-u) 92905 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
我怎样才能确保所有用户有相同的堆栈大小设置?
编辑:
[root@web3 ~]# tail /etc/security/limits.conf #* soft core 0 #* hard rss 10000 #@student hard nproc 20 #@faculty soft nproc 20 #@faculty hard nproc 50 #ftp hard nproc 0 #@student - maxlogins 4 * - stack 65536 apache - stack 65536 # End of file [root@web3 ~]#
即使我已经在/etc/security/limits.conf更改了这个设置并重启了服务器,apache的堆栈大小仍然是32768。
不知道为什么你想为所有用户设置相同的限制。 但是我会说一个理想的位置将是/ etc / profile或/ etc / bashrc。
在CentOS 6.4中,默认情况下,apache用户的主目录是/ var / www。 这也是Apache DocumentRoot。 由于apache用户的shell是/ sbin / nologin,所以在这里放置一个shellconfiguration文件不会太有用。
您可以在/etc/security/limits.conf中设置限制,但是可以在每个用户或每个组的基础上进行设置,这样可以实现正确的结果。 另外,在limits.conf中,您可以设置硬限制和软限制,以实现更灵活的configuration。
好的,我find了解决办法。 它看起来像是在/etc/init.d/httpd文件中默认设置的。 我手动改变它在每台服务器上,重新启动httpd ,现在它设置正确。