nginx 500 error

nginx服務器頻繁報“500 Internal Server Error”錯誤,是由於服務器上文炳數設置太小,
設置方法如下:
1>. /etc/security/limits.conf文件,最後加上兩句
 * soft nofile 65535 
 * hard nofile 65535
2>. /etc/sysctl.conf,增加:
fs.file-max=65536

3>. nginx配置文件nginx.conf,增加:
在worker_processes的下面增加一行
worker_rlimit_nofile 65535;
操作:
1>. sysctl -p
2>. 重啓nginx

注:看 /etc/profile 文件中是否存在“ ulimit -S -c 0 ”前面添加一個#號
#etc profile
cmd=`/bin/cat /etc/profile|grep 'ulimit -S -c 0'|grep -v '^#'`
if [ $cmd ]
then
/bin/sed -i 's/ulimit -S -c 0/#&/' /etc/profile
fi
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章