mc_apache / apache httpd functions

If you alter this module and want to test it, do not forget to deploy it on minion using:

salt '*' saltutil.sync_modules

Documentation of this module is available with:

salt '*' sys.doc mc_apache

Check the mc_apache states for details.

Do not forget to sync salt cache:

salt-call state.sls makina-states.controllers.salt
mc_states.modules.mc_apache.a2dismod(module)

Runs a2dismod for the given module.

This will only be functional on Debian-based operating systems (Ubuntu, Mint, etc).

module
string, module name

CLI Examples:

salt '*' mc_apache.a2dismod autoindex
mc_states.modules.mc_apache.a2enmod(module)

Runs a2enmod for the given module.

This will only be functional on Debian-based operating systems (Ubuntu, Mint, etc).

module
string, module name

CLI Examples:

salt '*' mc_apache.a2enmod autoindex
mc_states.modules.mc_apache.check_version(version)

Ensures the installed apache version matches all the given version number

For a given 2.2 version 2.2.x current version would return an OK state

version
The apache version

CLI Examples:

salt '*' mc_apache.check_version 2.4
mc_states.modules.mc_apache.get_version()

Ensures the installed apache version matches all the given version number

For a given 2.2 version 2.2.x current version would return an OK state

version
The apache version

CLI Examples:

salt '*' mc_apache.get_version
mc_states.modules.mc_apache.settings()

Registry for apache related settings

heses settings are loaded from defaults + grains + pillar. pache Fine Settings

httpd_user
apache system user
mpm
mpm to use
mpm-packages
system related packaged to install the desired mpm
version
targeted apache version to switch the configuration for
log_level
httpd log level
fastcgi_params
mappings of specific params for mod_fastcgi Please look the module code and the apache documentation if you are not happy with defaults
fastcgi_enabled
internal setting
fastcgi_socket_directory
internal setting
serveradmin_mail
default server admin email
Timeout
The number of seconds before receives and sends time out. default is 300 (5min), 1 or 2 min should be enough for any client request (so 60 or 120). beware of DOS!
KeepAlive
bool: are KeepAlive requests allowed
MaxKeepAliveRequests:
maximum number of allowed KeepAlive requests (compare with MaxClients)
KeepAliveTimeout:
How many seconds should we keep Keepalive conn open (say something between 3 and 5 usually, be careful for DOS!)
log_level
log level, allowed values are debug, info, notice, warn, error,
crit, alert, emerg
serveradmin_mail
default webmaster mail (used on error pages)

mpm prefork

StartServers
number of server processes to start
MinSpareServers
minimum number of server processes which are kept spare
MaxSpareServers
&maximum number of server processes which are kept spare
MaxRequestsPerChild
maximum number of requests a server process serves set 0 to disable process recylcing
MaxClients
(alias MaxRequestWorkers): maximum number of server processes allowed to start

mpm worker

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
ThreadLimit
ThreadsPerChild can be changed to this maximum value during a graceful restart. ThreadLimit can only be changed by stopping and starting Apache.
ThreadsPerChild
constant number of worker threads in each server process
MaxRequestsPerChild
(alias MaxConnectionsPerChild):
maximum number of requests a server process serves set 0 to disable process recylcing
MaxClients
(alias MaxRequestWorkers): maximum number of threads
mpm event

all workers settings are used

AsyncRequestWorkerFactor max of concurrent conn is:

(AsyncRequestWorkerFactor + 1) * MaxRequestWorkers
mc_states.modules.mc_apache.vhost_settings(domain, doc_root, **kwargs)

Used by apache macro

vh_top_source
source (jinja) of the file.managed for the virtualhost template. (empty by default) this will be included at the global conf level
vh_template_source
source (jinja) of the file.managed for the virtualhost template. this will be the vhost definitions which in turn include the vhost defs
vh_content_source
source (jinja) of the file.managed for the virtualhost template. this will be included at the vhost level
serveradmin_mail
data that may be used on error page default is webmaster@<site-name>
number
Virtualhost priority number (for apache), without a default VH the first one became the default virtualhost
redirect_aliases
True by default, make a special Virtualhost with all server_aliases, all redirecting with a 301 to the site name, better for SEO. But you may need real server_aliases for static parallel file servers, for example, then set that to True.
allow_htaccess
False by default, if your project use .htaccess files, then prey for your soul, eat some shit, kill yourself and set that to True
vhost_basename:
basename of file in /etc/apache2/sites-{enabled,available}
log_level
log level
ssl_interface/interface
interface of the namevirtualhost (like in “*:80”), default is “*”
ssl_port/port
port of the namevirtualhost (like in “*:80”), default is “80” and “443” for ssl version