Issue #1: Add updated vhosts file for Apache 2.4.

This commit is contained in:
Jeff Geerling 2014-10-05 18:15:56 -05:00
parent 83ab160cff
commit 3a277cbff6
7 changed files with 28 additions and 3 deletions

View file

@ -20,7 +20,7 @@
- name: Add apache vhosts configuration.
template: >
src=vhosts.conf.j2
src=vhosts-{{ apache_vhosts_version }}.conf.j2
dest={{ apache_conf_path }}/vhosts.conf
owner=root group=root mode=644
notify: restart apache

View file

@ -1,12 +1,12 @@
---
- name: Ensure Apache is installed (RedHat).
- name: Ensure Apache is installed.
yum: >
name={{ item }}
state=installed
enablerepo={{ apache_enablerepo }}
with_items: apache_packages
- name: Configure Apache (RedHat).
- name: Configure Apache.
lineinfile: >
dest={{ apache_server_root }}/conf/{{ apache_daemon }}.conf
regexp="{{ item.regexp }}"

View file

@ -0,0 +1,22 @@
DirectoryIndex index.php index.html
{# Set up VirtualHosts - servername and documentroot are required. #}
{% for vhost in apache_vhosts %}
<VirtualHost *:{{ apache_listen_port }}>
ServerName {{ vhost.servername }}
DocumentRoot {{ vhost.documentroot }}
{% if vhost.serveradmin is defined %}
ServerAdmin {{ vhost.serveradmin }}
{% endif %}
<Directory "{{ vhost.documentroot }}">
AllowOverride All
Options -Indexes +FollowSymLinks
Require all granted
</Directory>
{% if vhost.extra_parameters is defined %}
{{ vhost.extra_parameters }}
{% endif %}
</VirtualHost>
{% endfor %}

View file

@ -2,6 +2,7 @@
apache_daemon: apache2
apache_server_root: /etc/apache2
apache_conf_path: /etc/apache2/sites-enabled
apache_vhosts_version: "2.2"
__apache_packages:
- apache2
- apache2-mpm-prefork

View file

@ -2,6 +2,7 @@
apache_daemon: apache2
apache_server_root: /etc/apache2
apache_conf_path: /etc/apache2/sites-enabled
apache_vhosts_version: "2.4"
__apache_packages:
- apache2
- apache2-mpm-prefork

View file

@ -2,6 +2,7 @@
apache_daemon: httpd
apache_server_root: /etc/httpd
apache_conf_path: /etc/httpd/conf.d
apache_vhosts_version: "2.2"
__apache_packages:
- httpd
- httpd-devel