mirror of
https://github.com/geerlingguy/ansible-role-apache
synced 2025-01-03 08:40:18 +01:00
Issue #1: Add updated vhosts file for Apache 2.4.
This commit is contained in:
parent
83ab160cff
commit
3a277cbff6
7 changed files with 28 additions and 3 deletions
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
- name: Add apache vhosts configuration.
|
- name: Add apache vhosts configuration.
|
||||||
template: >
|
template: >
|
||||||
src=vhosts.conf.j2
|
src=vhosts-{{ apache_vhosts_version }}.conf.j2
|
||||||
dest={{ apache_conf_path }}/vhosts.conf
|
dest={{ apache_conf_path }}/vhosts.conf
|
||||||
owner=root group=root mode=644
|
owner=root group=root mode=644
|
||||||
notify: restart apache
|
notify: restart apache
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
---
|
---
|
||||||
- name: Ensure Apache is installed (RedHat).
|
- name: Ensure Apache is installed.
|
||||||
yum: >
|
yum: >
|
||||||
name={{ item }}
|
name={{ item }}
|
||||||
state=installed
|
state=installed
|
||||||
enablerepo={{ apache_enablerepo }}
|
enablerepo={{ apache_enablerepo }}
|
||||||
with_items: apache_packages
|
with_items: apache_packages
|
||||||
|
|
||||||
- name: Configure Apache (RedHat).
|
- name: Configure Apache.
|
||||||
lineinfile: >
|
lineinfile: >
|
||||||
dest={{ apache_server_root }}/conf/{{ apache_daemon }}.conf
|
dest={{ apache_server_root }}/conf/{{ apache_daemon }}.conf
|
||||||
regexp="{{ item.regexp }}"
|
regexp="{{ item.regexp }}"
|
||||||
|
|
22
templates/vhosts-2.4.conf.j2
Normal file
22
templates/vhosts-2.4.conf.j2
Normal 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 %}
|
|
@ -2,6 +2,7 @@
|
||||||
apache_daemon: apache2
|
apache_daemon: apache2
|
||||||
apache_server_root: /etc/apache2
|
apache_server_root: /etc/apache2
|
||||||
apache_conf_path: /etc/apache2/sites-enabled
|
apache_conf_path: /etc/apache2/sites-enabled
|
||||||
|
apache_vhosts_version: "2.2"
|
||||||
__apache_packages:
|
__apache_packages:
|
||||||
- apache2
|
- apache2
|
||||||
- apache2-mpm-prefork
|
- apache2-mpm-prefork
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
apache_daemon: apache2
|
apache_daemon: apache2
|
||||||
apache_server_root: /etc/apache2
|
apache_server_root: /etc/apache2
|
||||||
apache_conf_path: /etc/apache2/sites-enabled
|
apache_conf_path: /etc/apache2/sites-enabled
|
||||||
|
apache_vhosts_version: "2.4"
|
||||||
__apache_packages:
|
__apache_packages:
|
||||||
- apache2
|
- apache2
|
||||||
- apache2-mpm-prefork
|
- apache2-mpm-prefork
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
apache_daemon: httpd
|
apache_daemon: httpd
|
||||||
apache_server_root: /etc/httpd
|
apache_server_root: /etc/httpd
|
||||||
apache_conf_path: /etc/httpd/conf.d
|
apache_conf_path: /etc/httpd/conf.d
|
||||||
|
apache_vhosts_version: "2.2"
|
||||||
__apache_packages:
|
__apache_packages:
|
||||||
- httpd
|
- httpd
|
||||||
- httpd-devel
|
- httpd-devel
|
||||||
|
|
Loading…
Reference in a new issue