mod_mpm for RedHat (#160)
This commit is contained in:
parent
a5debf58b3
commit
7bac5c7c30
51
apache/files/RedHat/conf.modules.d/00-mpm.conf.jinja
Normal file
51
apache/files/RedHat/conf.modules.d/00-mpm.conf.jinja
Normal file
@ -0,0 +1,51 @@
|
||||
# managed by saltstack
|
||||
|
||||
{% set mpm_module = 'mpm_prefork' -%}
|
||||
{% set mpm_param = salt['pillar.get']('apache:mod_mpm_prefork', {}) -%}
|
||||
{% if pillar.get('apache:mod_mpm_worker') is defined -%}
|
||||
{% set mpm_module = 'mpm_worker' -%}
|
||||
{% set mpm_param = salt['pillar.get']('apache:mod_mpm_worker', {}) -%}
|
||||
{% else -%}
|
||||
{% endif -%}
|
||||
|
||||
LoadModule {{ mpm_module }}_module modules/mod_{{ mpm_module }}.so
|
||||
|
||||
# prefork MPM
|
||||
# StartServers: number of server processes to start
|
||||
# MinSpareServers: minimum number of server processes which are kept spare
|
||||
# ServerLimit: maximum number of server processes
|
||||
# MaxSpareServers: maximum number of server processes which are kept spare
|
||||
# MaxRequestWorkers: maximum number of server processes allowed to start
|
||||
# MaxConnectionsPerChild: maximum number of requests a server process serves
|
||||
|
||||
<IfModule mpm_prefork_module>
|
||||
StartServers {{ mpm_param['start_servers'] | d('5') }}
|
||||
MaxRequestWorkers {{ mpm_param['max_request_workers'] | d('150') }}
|
||||
{%- if mpm_param['max_request_workers'] | d('150') >= 256 %}
|
||||
ServerLimit {{ mpm_param['max_request_workers'] | d('150') }}
|
||||
{%- endif %}
|
||||
MinSpareServers {{ mpm_param['min_spare_servers'] | d('5') }}
|
||||
MaxSpareServers {{ mpm_param['max_spare_servers'] | d('10') }}
|
||||
MaxConnectionsPerChild {{ mpm_param['max_connections_per_child'] | d('0') }}
|
||||
</IfModule>
|
||||
|
||||
# worker MPM
|
||||
# StartServers: initial number of server processes to start
|
||||
# MinSpareThreads: minimum number of worker threads which are kept spare
|
||||
# MaxSpareThreads: maximum number of worker threads which are kept spare
|
||||
# ThreadsPerChild: constant number of worker threads in each server process
|
||||
# MaxRequestWorkers: maximum number of worker threads
|
||||
# MaxConnectionsPerChild: maximum number of connections a server process serves
|
||||
# before terminating
|
||||
|
||||
<IfModule mpm_worker_module>
|
||||
StartServers {{ mpm_param['start_servers'] | d('2') }}
|
||||
MaxRequestWorkers {{ mpm_param['max_request_workers'] | d('150') }}
|
||||
MinSpareThreads {{ mpm_param['min_spare_threads'] | d('25') }}
|
||||
MaxSpareThreads {{ mpm_param['max_spare_threads'] | d('75') }}
|
||||
ThreadLimit {{ mpm_param['thread_limit'] | d('64') }}
|
||||
ThreadsPerChild {{ mpm_param['threads_per_child'] | d('25') }}
|
||||
MaxConnectionsPerChild {{ mpm_param['max_connections_per_child'] | d('0') }}
|
||||
</IfModule>
|
||||
|
||||
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
@ -73,6 +73,8 @@
|
||||
'logrotatedir': '/etc/logrotate.d/httpd',
|
||||
'wwwdir': '/var/www',
|
||||
'default_charset': 'UTF-8',
|
||||
'use_require': False,
|
||||
'moddir': '/etc/httpd/conf.modules.d',
|
||||
},
|
||||
'Suse': {
|
||||
'server': 'apache2',
|
||||
|
@ -1,7 +1,8 @@
|
||||
{% if grains['os_family']=="Debian" %}
|
||||
{% from "apache/map.jinja" import apache with context %}
|
||||
{% set mpm_module = salt['pillar.get']('apache:mpm:module', 'mpm_prefork') %}
|
||||
|
||||
{% if grains['os_family']=="Debian" %}
|
||||
|
||||
include:
|
||||
- apache
|
||||
|
||||
@ -36,3 +37,21 @@ a2dismod {{ mod }}:
|
||||
{% endfor %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if grains['os_family']=="RedHat" %}
|
||||
|
||||
include:
|
||||
- apache
|
||||
|
||||
{{ apache.moddir }}/00-mpm-conf.conf:
|
||||
file.managed:
|
||||
- name: {{ apache.moddir }}/00-mpm.conf
|
||||
- template: jinja
|
||||
- source:
|
||||
- salt://apache/files/RedHat/conf.modules.d/00-mpm.conf.jinja
|
||||
- require:
|
||||
- pkg: httpd
|
||||
- watch_in:
|
||||
- module: apache-restart
|
||||
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user