Allow the listen host address to be set for apache
authorTom Hughes <tom@compton.nu>
Mon, 9 Sep 2013 09:16:00 +0000 (10:16 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 9 Sep 2013 09:16:51 +0000 (10:16 +0100)
cookbooks/apache/attributes/default.rb
cookbooks/apache/recipes/default.rb
cookbooks/apache/templates/default/ports.conf.erb [new file with mode: 0644]

index 23ef3397ae520cf7385c55c605676ec1af511fd7..73184f049563b0ad388689f0341cff0bd3cfa44b 100644 (file)
@@ -25,3 +25,5 @@ default[:apache][:event][:max_spare_threads] = 75
 default[:apache][:event][:thread_limit] = 64
 default[:apache][:event][:threads_per_child] = 25
 default[:apache][:event][:max_requests_per_child] = 0
+
+default[:apache][:listen_address] = "*"
index 9fa7fed8536fea6347594570008675ad4e0f6743..4fa9b3bc38655f87ebd403992f70d5f078992715 100644 (file)
@@ -29,6 +29,13 @@ template "/etc/apache2/httpd.conf" do
   mode 0644
 end
 
+template "/etc/apache2/ports.conf" do
+  source "ports.conf.erb"
+  owner "root"
+  group "root"
+  mode 0644
+end
+
 service "apache2" do
   action [ :enable, :start ]
   supports :status => true, :restart => true, :reload => true
diff --git a/cookbooks/apache/templates/default/ports.conf.erb b/cookbooks/apache/templates/default/ports.conf.erb
new file mode 100644 (file)
index 0000000..588fcee
--- /dev/null
@@ -0,0 +1,15 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+# Listen on port 80
+NameVirtualHost *:80
+Listen <%= node[:apache][:listen_address] %>:80
+
+# Listen on port 443 if mod_ssl is enabled
+<IfModule mod_ssl.c>
+    Listen <%= node[:apache][:listen_address] %>:443
+</IfModule>
+
+# Listen on port 443 if mod_gnutls is enabled
+<IfModule mod_gnutls.c>
+    Listen <%= node[:apache][:listen_address] %>:443
+</IfModule>