Browse Source

Improve document root fix for Red Hat (#241)

The docroot fix from PR#240 worked fine for default servers.
But as soon as one uses vhosts this broke as the vhosts were
created under the docroot in /var/www/html rather than the better
/var/www.

Fix this by differentiating between docroot and wwwdir.
Further allow to override both in Red Hat-style configs.
The override allows to reuse this formula for the softwarecollections
rpms.
tags/v0.37.4
Andreas Thienemann 6 years ago
parent
commit
4ed6e228f5
3 changed files with 17 additions and 17 deletions
  1. +8
    -8
      apache/files/RedHat/apache-2.2.config.jinja
  2. +8
    -8
      apache/files/RedHat/apache-2.4.config.jinja
  3. +1
    -1
      apache/map.jinja

+ 8
- 8
apache/files/RedHat/apache-2.2.config.jinja View File

# same ServerRoot for multiple httpd daemons, you will need to change at # same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile. # least PidFile.
# #
ServerRoot "/etc/httpd"
ServerRoot "{{ apache.get('serverroot', '/etc/httpd') }}"


# #
# Listen: Allows you to bind Apache to specific IP addresses and/or # Listen: Allows you to bind Apache to specific IP addresses and/or
# documents. By default, all requests are taken from this directory, but # documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations. # symbolic links and aliases may be used to point to other locations.
# #
DocumentRoot "/var/www/html"
DocumentRoot "{{ apache.get('docroot', apache.wwwdir + '/html') }}"


# #
# Relax access to content within /var/www.
# Relax access to content within {{ apache.wwwdir }}.
# #
<Directory "/var/www">
<Directory "{{ apache.wwwdir }}">
AllowOverride None AllowOverride None
# Allow open access: # Allow open access:
Order allow,deny Order allow,deny
</Directory> </Directory>


# Further relax access to the default document root: # Further relax access to the default document root:
<Directory "/var/www/html">
<Directory "{{ apache.get('docroot', apache.wwwdir + '/html') }}">
# #
# Possible values for the Options directive are "None", "All", # Possible values for the Options directive are "None", "All",
# or any combination of: # or any combination of:
# client. The same rules about trailing "/" apply to ScriptAlias # client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias. # directives as to Alias.
# #
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
ScriptAlias /cgi-bin/ "{{ apache.wwwdir }}/cgi-bin/"


</IfModule> </IfModule>


# #
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# "{{ apache.wwwdir }}/cgi-bin/" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured. # CGI directory exists, if you have that configured.
# #
<Directory "/var/www/cgi-bin">
<Directory "{{ apache.wwwdir }}/cgi-bin/">
AllowOverride None AllowOverride None
Options None Options None
Order allow,deny Order allow,deny

+ 8
- 8
apache/files/RedHat/apache-2.4.config.jinja View File

# same ServerRoot for multiple httpd daemons, you will need to change at # same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile. # least PidFile.
# #
ServerRoot "/etc/httpd"
ServerRoot "{{ apache.get('serverroot', '/etc/httpd') }}"


# #
# Listen: Allows you to bind Apache to specific IP addresses and/or # Listen: Allows you to bind Apache to specific IP addresses and/or
# documents. By default, all requests are taken from this directory, but # documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations. # symbolic links and aliases may be used to point to other locations.
# #
DocumentRoot "{{ apache.wwwdir }}"
DocumentRoot "{{ apache.get('docroot', apache.wwwdir + '/html') }}"


# #
# Relax access to content within /var/www.
# Relax access to content within {{ apache.wwwdir }}.
# #
<Directory "/var/www">
<Directory "{{ apache.wwwdir }}">
AllowOverride None AllowOverride None
# Allow open access: # Allow open access:
Require all granted Require all granted
</Directory> </Directory>


# Further relax access to the default document root: # Further relax access to the default document root:
<Directory "{{ apache.wwwdir }}">
<Directory "{{ apache.get('docroot', apache.wwwdir + '/html') }}">
# #
# Possible values for the Options directive are "None", "All", # Possible values for the Options directive are "None", "All",
# or any combination of: # or any combination of:
# client. The same rules about trailing "/" apply to ScriptAlias # client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias. # directives as to Alias.
# #
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
ScriptAlias /cgi-bin/ "{{ apache.wwwdir }}/cgi-bin/"


</IfModule> </IfModule>


# #
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# "{{ apache.wwwdir }}/cgi-bin/" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured. # CGI directory exists, if you have that configured.
# #
<Directory "/var/www/cgi-bin">
<Directory "{{ apache.wwwdir }}/cgi-bin/">
AllowOverride None AllowOverride None
Options None Options None
Require all granted Require all granted

+ 1
- 1
apache/map.jinja View File

'default_site_ssl': 'default-ssl', 'default_site_ssl': 'default-ssl',
'logdir': '/var/log/httpd', 'logdir': '/var/log/httpd',
'logrotatedir': '/etc/logrotate.d/httpd', 'logrotatedir': '/etc/logrotate.d/httpd',
'wwwdir': '/var/www/html',
'wwwdir': '/var/www',
'default_charset': 'UTF-8', 'default_charset': 'UTF-8',
'use_require': False, 'use_require': False,
'moddir': '/etc/httpd/conf.modules.d', 'moddir': '/etc/httpd/conf.modules.d',

Loading…
Cancel
Save