AWS Elastic Beanstalk – Apache正在不断重启

我已经在AWS Elastic Beanstalk上部署了一个Django应用程序。 最近我遇到了Apache的问题,因为它经常重启。

查看我的Elastic Beanstalk仪表板

最初看文件/ var / log / httpd / error_log我得到以下错误:

[Wed Apr 12 08:50:51.371533 2017] [mpm_prefork:error] [pid 17847] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting 

所以我configurationApache如下:

 # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to "Off" to deactivate. KeepAlive On # MaxKeepAliveRequests: The maximum number of requests to allow # during a persistent connection. Set to 0 to allow an unlimited amount. # We recommend you leave this number high, for maximum performance. MaxKeepAliveRequests 500 # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. KeepAliveTimeout 20 <IfModule mpm_prefork_module> ServerLimit 60 MaxRequestWorkers 1000 StartServers 18 MinSpareServers 3 MaxSpareServers 6 MaxConnectionsPerChild 1000 ListenBacklog 1000 </IfModule> 

问题没有解决,以下是错误:

 [Tue Apr 18 00:15:23.037564 2017] [mpm_prefork:error] [pid 7816] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting ... [Tue Apr 18 03:01:01.786908 2017] [mpm_prefork:notice] [pid 7816] AH00173: SIGHUP received. Attempting to restart [Tue Apr 18 03:01:01.851941 2017] [so:warn] [pid 7816] AH01574: module wsgi_module is already loaded, skipping [Tue Apr 18 03:01:01.874858 2017] [mpm_prefork:warn] [pid 7816] AH00181: MaxRequestWorkers of 1000 exceeds ServerLimit value of 60, decreasing to match [Tue Apr 18 03:01:01.875556 2017] [auth_digest:notice] [pid 7816] AH01757: generating secret for digest authentication ... [Tue Apr 18 03:01:01.876190 2017] [lbmethod_heartbeat:notice] [pid 7816] AH02282: No slotmem from mod_heartmonitor [Tue Apr 18 03:01:01.927425 2017] [mpm_prefork:notice] [pid 7816] AH00163: Apache/2.4.25 (Amazon) mod_wsgi/3.5 Python/3.4.3 configured -- resuming normal operations [Tue Apr 18 03:01:01.927452 2017] [core:notice] [pid 7816] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' 

更新:

ServerLimit必须大于或等于MaxRequestWorkers

 <IfModule mpm_prefork_module> ServerLimit 1000 MaxRequestWorkers 1000 StartServers 18 MinSpareServers 3 MaxSpareServers 6 MaxConnectionsPerChild 1000 ListenBacklog 1000 </IfModule> 

现在,我不再得到mpm_prefork错误/警告,并且Apache不再closures。