Enables the Apache module mod_proxy_http and requires the Apache module mod_proxy to be enabled. (Debian Only) | Enables the Apache module mod_proxy_http and requires the Apache module mod_proxy to be enabled. (Debian Only) | ||||
``apache.mod_proxy_fcgi`` | |||||
------------------------- | |||||
Enables the Apache module mod_proxy_fcgi and requires the Apache module mod_proxy to be enabled. (Debian Only) | |||||
``apache.mod_wsgi`` | ``apache.mod_wsgi`` | ||||
------------------- | ------------------- | ||||
Installs and enables the mod_fcgid module | Installs and enables the mod_fcgid module | ||||
``apache.mod_fastcgi`` | |||||
-------------------- | |||||
Installs and enables the mod_fastcgi module | |||||
``apache.mod_dav_svn`` | ``apache.mod_dav_svn`` | ||||
-------------------- | -------------------- | ||||
Enables and configures the Apache module mod_remoteip using data from Pillar. (Debian Only) | Enables and configures the Apache module mod_remoteip using data from Pillar. (Debian Only) | ||||
``apache.mod_xsendfile`` | |||||
---------------------- | |||||
Installs and enables mod_xsendfile module. (Debian Only) | |||||
``apache.own_default_vhost`` | ``apache.own_default_vhost`` | ||||
-------------------------- | -------------------------- | ||||
Installs and configures Apache on Debian and Ubuntu systems. | Installs and configures Apache on Debian and Ubuntu systems. | ||||
``apache.uninstall`` | |||||
---------- | |||||
Stops the Apache service and uninstalls the package. | |||||
These states are ordered using the ``order`` declaration. Different stages | These states are ordered using the ``order`` declaration. Different stages | ||||
are divided into the following number ranges: | are divided into the following number ranges: | ||||
{{ apache.vhostdir }}: | {{ apache.vhostdir }}: | ||||
file.directory: | file.directory: | ||||
- makedirs: True | |||||
- require: | - require: | ||||
- pkg: apache | - pkg: apache | ||||
- watch_in: | - watch_in: |
'mod_perl2': 'libapache2-mod-perl2', | 'mod_perl2': 'libapache2-mod-perl2', | ||||
'mod_fcgid': 'libapache2-mod-fcgid', | 'mod_fcgid': 'libapache2-mod-fcgid', | ||||
'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb', | 'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb', | ||||
'mod_xsendfile': 'libapache2-mod-xsendfile', | |||||
'mod_fastcgi': 'libapache2-mod-fastcgi', | |||||
'vhostdir': '/etc/apache2/sites-available', | 'vhostdir': '/etc/apache2/sites-available', | ||||
'confdir': '/etc/apache2/conf.d', | 'confdir': '/etc/apache2/conf.d', | ||||
'configfile': '/etc/httpd/conf/httpd.conf', | 'configfile': '/etc/httpd/conf/httpd.conf', | ||||
'mod_wsgi': 'mod_wsgi', | 'mod_wsgi': 'mod_wsgi', | ||||
'conf_mod_wsgi': '/etc/httpd/conf.d/wsgi.conf', | |||||
'mod_php5': 'php', | 'mod_php5': 'php', | ||||
'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm', | 'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm', | ||||
{% from "apache/map.jinja" import apache with context %} | |||||
include: | |||||
- apache | |||||
- apache.mod_actions | |||||
{% if grains['os_family']=="Debian" %} | |||||
mod-fastcgi: | |||||
pkg.installed: | |||||
- name: {{ apache.mod_fastcgi }} | |||||
- order: 180 | |||||
- require: | |||||
- pkgrepo: repo-fastcgi | |||||
- pkg: apache | |||||
repo-fastcgi: | |||||
pkgrepo.managed: | |||||
- name: "deb http://httpredir.debian.org/debian jessie" | |||||
- file: /etc/apt/sources.list.d/non-free.list | |||||
- comps: non-free | |||||
a2enmod fastcgi: | |||||
cmd.run: | |||||
- unless: ls /etc/apache2/mods-enabled/fastcgi.load | |||||
- order: 225 | |||||
- require: | |||||
- pkg: mod-fastcgi | |||||
- watch_in: | |||||
- module: apache-restart | |||||
{% endif %} | |||||
{% if grains['os_family']=="Debian" %} | |||||
include: | |||||
- apache | |||||
- apache.mod_proxy | |||||
a2enmod proxy_fcgi: | |||||
cmd.run: | |||||
- unless: ls /etc/apache2/mods-enabled/proxy_fcgi.load | |||||
- order: 225 | |||||
- require: | |||||
- pkg: apache | |||||
- cmd: a2enmod proxy | |||||
- watch_in: | |||||
- module: apache-restart | |||||
{% endif %} |
- require: | - require: | ||||
- pkg: apache | - pkg: apache | ||||
{% if grains.get('os_family') == 'RedHat' %} | |||||
/etc/httpd/conf.d/wsgi.conf: | |||||
{% if apache.conf_mod_wsgi %} | |||||
{{ apache.conf_mod_wsgi }}: | |||||
file.uncomment: | file.uncomment: | ||||
- regex: LoadModule | - regex: LoadModule | ||||
- onlyif: test -f {{ apache.conf_mod_wsgi }} | |||||
- require: | - require: | ||||
- pkg: mod_wsgi | - pkg: mod_wsgi | ||||
{% endif %} | {% endif %} |
{% from "apache/map.jinja" import apache with context %} | |||||
include: | |||||
- apache | |||||
mod-xsendfile: | |||||
pkg.installed: | |||||
- name: {{ apache.mod_xsendfile }} | |||||
- order: 180 | |||||
- require: | |||||
- pkg: apache | |||||
{% if grains['os_family']=="Debian" %} | |||||
a2enmod xsendfile: | |||||
cmd.run: | |||||
- order: 225 | |||||
- unless: ls /etc/apache2/mods-enabled/xsendfile.load | |||||
- require: | |||||
- pkg: mod-xsendfile | |||||
- watch_in: | |||||
- module: apache-restart | |||||
{% endif %} | |||||
version: '2.2' | version: '2.2' | ||||
Red Hat Enterprise Linux Server-7: | Red Hat Enterprise Linux Server-7: | ||||
version: '2.4' | version: '2.4' | ||||
CentOS Linux-6: | |||||
CentOS-6: | |||||
version: '2.2' | version: '2.2' | ||||
CentOS Linux-7: | CentOS Linux-7: | ||||
version: '2.4' | version: '2.4' | ||||
conf_mod_wsgi: '/etc/httpd/conf.modules.d/10-wsgi.conf' | |||||
Oracle Linux Server-6: | Oracle Linux Server-6: | ||||
version: '2.2' | version: '2.2' | ||||
Oracle Linux Server-7: | Oracle Linux Server-7: |
{# Define default values here so the template below can just focus on layout #} | |||||
{%- set sitename = site.get('ServerName', id) -%} | |||||
{%- set vals = { | |||||
'interfaces': site.get('interface', '*').split(), | |||||
'port': site.get('port', '80'), | |||||
'ServerName': sitename, | |||||
'ServerAlias': site.get('ServerAlias', 'www.{0}'.format(sitename)), | |||||
'ServerAdmin': site.get('ServerAdmin', 'webmaster@{0}'.format(sitename)), | |||||
'LogLevel': site.get('LogLevel', 'warn'), | |||||
'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)), | |||||
'CustomLog': site.get('CustomLog', '{0}/{1}-access.log'.format(map.logdir, sitename)), | |||||
'DocumentRoot': site.get('DocumentRoot', '{0}/{1}'.format(map.wwwdir, sitename)) | |||||
} -%} | |||||
<VirtualHost {% for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}> | |||||
ServerName {{ vals.ServerName }} | |||||
{% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %} | |||||
{% if site.get('ServerAdmin') != False %}ServerAdmin {{ vals.ServerAdmin }}{% endif %} | |||||
{% if site.get('DocumentRoot') != False -%}DocumentRoot {{ vals.DocumentRoot }}{% endif %} | |||||
{% if site.get('LogLevel') != False -%}LogLevel {{ vals.LogLevel }}{% endif %} | |||||
{% if site.get('ErrorLog') != False -%}ErrorLog {{ vals.ErrorLog }}{% endif %} | |||||
{% if site.get('CustomLog') != False -%}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %} | |||||
</VirtualHost> |
example.com: # must be unique; used as an ID declaration in Salt. | example.com: # must be unique; used as an ID declaration in Salt. | ||||
enabled: True | enabled: True | ||||
template_file: salt://apache/vhosts/standard.tmpl # or redirect.tmpl or proxy.tmpl | |||||
template_file: salt://apache/vhosts/standard.tmpl # or minimal.tmpl or redirect.tmpl or proxy.tmpl | |||||
####################### DEFAULT VALUES BELOW ############################ | ####################### DEFAULT VALUES BELOW ############################ | ||||
# NOTE: the values below are simply default settings that *can* be | # NOTE: the values below are simply default settings that *can* be |