apache: Fix file names with port based SSL virtual hosts

Ubuntu 10.04's apache ignores config files with colons in the name.
This commit is contained in:
Ossi Salmi 2013-11-05 10:16:19 +02:00
parent 7ca414fc9f
commit 1b87c7bd04
2 changed files with 10 additions and 7 deletions

View file

@ -308,8 +308,10 @@ define apache::sslsite($first=false, $hsts=false, $ipaddr="_default_", $root="",
include apache::mod::headers
}
if $name =~ /:([0-9]+)$/ {
$port = $1
if $name =~ /(.*):([0-9]+)$/ {
$site = $1
$port = $2
$name_real = "${site}.${port}"
if ! defined(Apache::Configfile["listen_${port}.conf"]) {
apache::configfile { "listen_${port}.conf":
http => false,
@ -318,12 +320,13 @@ define apache::sslsite($first=false, $hsts=false, $ipaddr="_default_", $root="",
}
} else {
$port = "443"
$name_real = $name
}
case $::operatingsystem {
"debian","ubuntu": {
$apache_ssldir = "/etc/ssl"
apache::debian::sslsite { $name:
apache::debian::sslsite { $name_real:
first => $first,
hsts => $hsts,
ipaddr => $ipaddr,
@ -338,7 +341,7 @@ define apache::sslsite($first=false, $hsts=false, $ipaddr="_default_", $root="",
}
"centos","redhat","fedora": {
$apache_ssldir = "/etc/pki/tls"
apache::redhat::sslsite { $name:
apache::redhat::sslsite { $name_real:
first => $first,
hsts => $hsts,
ipaddr => $ipaddr,
@ -356,9 +359,9 @@ define apache::sslsite($first=false, $hsts=false, $ipaddr="_default_", $root="",
}
}
$site_fqdn = $name ? {
$site_fqdn = $name_real ? {
"default" => $::homename,
default => $name,
default => $name_real,
}
apache::webalizer::site { "https/${site_fqdn}":
site_proto => "https",

View file

@ -1,7 +1,7 @@
<VirtualHost <%= @ipaddr %>:<%= @port %>>
# General setup for the virtual host, inherited from global configuration
ServerName <%= @site_fqdn %>
ServerName <%= @site_fqdn.sub(/\.([0-9]+)$/, ':\1') %>
# Use separate log files for the SSL virtual host; note that LogLevel
# is not inherited from httpd.conf.