Nginx http 500错误分析及解决方法

 Nginx http 500错误分析及解决方法

 
 
 
出现场景:
 
在用nginx做负载均衡服务器对系统做并发测试,并发量比较大时Nginx会报出Http 500错误
  
报错原因:
 访问量大的时候,由于系统资源限制,而不能打开过多的文件
 
原因查找:
 
  • 打开nginx错误日志(/usr/local/nginx/logs/error.log) 
  • 查看是否报too many open files错误 
 
错误解决: 
  • 打开/etc/security/limits.conf
  • 修改 limits.conf文件,加上下面两句命令
   * soft nofile 65535
  * hard nofile 65535
  • 打开/usr/local/nginx/conf/nginx.conf,在worker_processes的下面增加一行配置
   worker_rlimit_nofile 65535; 
  • 重新启动nginx,问题解决  

 

posted @ 2022-01-28 19:51  kelelipeng  阅读(2361)  评论(0编辑  收藏  举报