From 88c6a98a5cfd33a7ba75a15ad6b09621b71768a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Wed, 22 Oct 2014 12:15:04 +0200 Subject: [PATCH] allow disabling default vhosts under 2.4 when disabling the default vhost(s) under 2.4, there's nothing to include in $sites-enabled/, which causes the following error: The apache2 configtest failed. Output of config test was: apache2: Syntax error on line 46 of /etc/apache2/apache2.conf: No matches for the wildcard '*' in '/etc/apache2/sites-enabled', failing (use IncludeOptional if required) Action 'configtest' failed. The Apache error log may have more information. by using IncludeOptional (as recommended), we allow the use of httpd as simple web server, with single purpose configuration, without having to define a (default) vhost. --- templates/httpd.conf.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/httpd.conf.erb b/templates/httpd.conf.erb index 68d6b50ae..e1075e38c 100644 --- a/templates/httpd.conf.erb +++ b/templates/httpd.conf.erb @@ -70,7 +70,11 @@ IncludeOptional "<%= @confd_dir %>/*.conf" Include "<%= @confd_dir %>/*.conf" <%- end -%> <% if @vhost_load_dir != @confd_dir -%> +<%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%> +IncludeOptional "<%= @vhost_load_dir %>/*" +<%- else -%> Include "<%= @vhost_load_dir %>/*" +<%- end -%> <% end -%> <% if @error_documents -%>