Я был развернут на 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
Итак, я настроил Apache следующим образом:
# 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 больше не закрывается.