view modules/apache/templates/httpd.conf.erb @ 257:675c1cc61eaf

Update Apache module to get CentOS 8 support Unfortunately it only fixes some bits. mod_wsgi still needs other approaches This also overrides the vhost modification to make them come last in the import order (after module loading)
author IBBoard <dev@ibboard.co.uk>
date Sun, 22 Dec 2019 14:43:29 -0500
parents 37675581a273
children d9352a684e62
line wrap: on
line source

# Security
ServerTokens <%= @server_tokens %>
ServerSignature <%= scope.function_bool2httpd([@server_signature]) %>
TraceEnable <%= scope.function_bool2httpd([@trace_enable]) %>

ServerName "<%= @servername %>"
ServerRoot "<%= @server_root %>"
PidFile <%= @pidfile %>
Timeout <%= @timeout %>
KeepAlive <%= @keepalive %>
MaxKeepAliveRequests <%= @max_keepalive_requests %>
KeepAliveTimeout <%= @keepalive_timeout %>
LimitRequestFieldSize <%= @limitreqfieldsize %>

<%- if @rewrite_lock and scope.function_versioncmp([@apache_version, '2.2']) <= 0 -%>
RewriteLock <%= @rewrite_lock %>
<%- end -%>

User <%= @user %>
Group <%= @group %>

AccessFileName .htaccess
<FilesMatch "^\.ht">
<%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%>
    Require all denied
<%- else -%>
     Order allow,deny
     Deny from all
     Satisfy all
<%- end -%>
</FilesMatch>

<Directory />
  Options <%= Array(@root_directory_options).join(' ') %>
  AllowOverride None
<%- if @root_directory_secured -%>
<%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%>
  Require all denied
<%- else -%>
  Order deny,allow
  Deny from all
<%- end -%>
<%- end -%>
</Directory>

<% if @default_charset -%>
AddDefaultCharset <%= @default_charset %>
<% end -%>

<%- if scope.function_versioncmp([@apache_version, '2.4']) < 0 -%>
DefaultType <%= @default_type %>
<%- end -%>
HostnameLookups Off
<%- if /^[|\/]/.match(@error_log) || /^syslog:/.match(@error_log) -%>
ErrorLog "<%= @error_log %>"
<%- else -%>
ErrorLog "<%= @logroot %>/<%= @error_log %>"
<%- end -%>
LogLevel <%= @log_level %>
EnableSendfile <%= @sendfile %>
<%- if @allow_encoded_slashes -%>
AllowEncodedSlashes <%= @allow_encoded_slashes %>
<%- end -%>

#Listen 80

<% if @apxs_workaround -%>
# Workaround: without this hack apxs would be confused about where to put
# LoadModule directives and fail entire procedure of apache package
# installation/reinstallation. This problem was observed on FreeBSD (apache22).
#LoadModule fake_module libexec/apache22/mod_fake.so
<% end -%>

Include "<%= @mod_load_dir %>/*.load"
<% if @mod_load_dir != @confd_dir and @mod_load_dir != @vhost_load_dir -%>
Include "<%= @mod_load_dir %>/*.conf"
<% end -%>
Include "<%= @ports_file %>"

<% unless @log_formats.has_key?('combined') -%>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
<% end -%>
<% unless @log_formats.has_key?('common') -%>
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<% end -%>
<% unless @log_formats.has_key?('referer') -%>
LogFormat "%{Referer}i -> %U" referer
<% end -%>
<% unless @log_formats.has_key?('agent') -%>
LogFormat "%{User-agent}i" agent
<% end -%>
<% unless @log_formats.has_key?('forwarded') -%>
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"" forwarded
<% end -%>
<% if @log_formats and !@log_formats.empty? -%>
  <%- @log_formats.sort.each do |nickname,format| -%>
LogFormat "<%= format -%>" <%= nickname %>
  <%- end -%>
<% end -%>

<%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%>
IncludeOptional "<%= @confd_dir %>/*.conf"
<%- else -%>
Include "<%= @confd_dir %>/*.conf"
<%- end -%>
<% if @vhost_load_dir != @confd_dir -%>
<%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%>
IncludeOptional "<%= @vhost_load_dir %>/<%= @vhost_include_pattern %>"
<%- else -%>
Include "<%= @vhost_load_dir %>/<%= @vhost_include_pattern %>"
<%- end -%>
<% end -%>

<% if @error_documents -%>
# /usr/share/apache2/error on debian
Alias /error/ "<%= @error_documents_path %>/"

<Directory "<%= @error_documents_path %>">
  AllowOverride None
  Options IncludesNoExec
  AddOutputFilter Includes html
  AddHandler type-map var
<%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%>
  Require all granted
<%- else -%>
  Order allow,deny
  Allow from all
<%- end -%>
  LanguagePriority en cs de es fr it nl sv pt-br ro
  ForceLanguagePriority Prefer Fallback
</Directory>

ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
ErrorDocument 410 /error/HTTP_GONE.html.var
ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
<% end -%>