apache: Combined proxy.http.conf.erb to site.http.conf.erb.
This commit is contained in:
parent
165ec9cbe4
commit
6cebef3715
4 changed files with 38 additions and 47 deletions
|
@ -88,7 +88,7 @@ class apache::debian::server inherits apache::debian::common {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
define apache::debian::site($aliases, $root, $redirect) {
|
define apache::debian::site($aliases, $root, $redirect, $proxy) {
|
||||||
|
|
||||||
if $name == "default" {
|
if $name == "default" {
|
||||||
$site_fqdn = $homename
|
$site_fqdn = $homename
|
||||||
|
@ -100,7 +100,7 @@ define apache::debian::site($aliases, $root, $redirect) {
|
||||||
$site_confdir = "/etc/apache2/sites-enabled/${site_fqdn}.d"
|
$site_confdir = "/etc/apache2/sites-enabled/${site_fqdn}.d"
|
||||||
|
|
||||||
if !$redirect {
|
if !$redirect {
|
||||||
if !$proxy {
|
if $proxy == "" {
|
||||||
if $root {
|
if $root {
|
||||||
file { "/srv/www/http/${site_fqdn}":
|
file { "/srv/www/http/${site_fqdn}":
|
||||||
ensure => link,
|
ensure => link,
|
||||||
|
@ -131,8 +131,8 @@ define apache::debian::site($aliases, $root, $redirect) {
|
||||||
file { $site_conf:
|
file { $site_conf:
|
||||||
ensure => present,
|
ensure => present,
|
||||||
mode => "0644",
|
mode => "0644",
|
||||||
owner => root,
|
owner => "root",
|
||||||
group => root,
|
group => "root",
|
||||||
notify => Service["apache2"],
|
notify => Service["apache2"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,19 +140,16 @@ define apache::debian::site($aliases, $root, $redirect) {
|
||||||
File[$site_conf] {
|
File[$site_conf] {
|
||||||
content => "<VirtualHost *:80>\n ServerName ${site_fqdn}\n Redirect permanent / ${redirect}\n</VirtualHost>\n",
|
content => "<VirtualHost *:80>\n ServerName ${site_fqdn}\n Redirect permanent / ${redirect}\n</VirtualHost>\n",
|
||||||
}
|
}
|
||||||
} elsif $proxy {
|
|
||||||
File[$site_conf] {
|
|
||||||
content => template("apache/proxy.http.conf.erb"),
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
File[$site_conf] {
|
File[$site_conf] {
|
||||||
content => template("apache/site.http.conf.erb"),
|
content => template("apache/site.http.conf.erb"),
|
||||||
}
|
}
|
||||||
|
if $proxy == "" {
|
||||||
file { $site_confdir:
|
file { $site_confdir:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
mode => "0644",
|
mode => "0644",
|
||||||
owner => root,
|
owner => "root",
|
||||||
group => root,
|
group => "root",
|
||||||
purge => true,
|
purge => true,
|
||||||
force => true,
|
force => true,
|
||||||
recurse => true,
|
recurse => true,
|
||||||
|
@ -162,6 +159,7 @@ define apache::debian::site($aliases, $root, $redirect) {
|
||||||
notify => Service["apache2"],
|
notify => Service["apache2"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ define apache::redhat::site($aliases, $root, $redirect, $proxy) {
|
||||||
$site_confdir = "/etc/httpd/site.http.d/${site_fqdn}.d"
|
$site_confdir = "/etc/httpd/site.http.d/${site_fqdn}.d"
|
||||||
|
|
||||||
if !$redirect {
|
if !$redirect {
|
||||||
if !$proxy {
|
if $proxy == "" {
|
||||||
if $root {
|
if $root {
|
||||||
file { "/srv/www/http/${site_fqdn}":
|
file { "/srv/www/http/${site_fqdn}":
|
||||||
ensure => link,
|
ensure => link,
|
||||||
|
@ -98,19 +98,16 @@ define apache::redhat::site($aliases, $root, $redirect, $proxy) {
|
||||||
File[$site_conf] {
|
File[$site_conf] {
|
||||||
content => "<VirtualHost *:80>\n ServerName ${site_fqdn}\n Redirect permanent / ${redirect}\n</VirtualHost>\n",
|
content => "<VirtualHost *:80>\n ServerName ${site_fqdn}\n Redirect permanent / ${redirect}\n</VirtualHost>\n",
|
||||||
}
|
}
|
||||||
} elsif $proxy {
|
|
||||||
File[$site_conf] {
|
|
||||||
content => template("apache/proxy.http.conf.erb"),
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
File[$site_conf] {
|
File[$site_conf] {
|
||||||
content => template("apache/site.http.conf.erb"),
|
content => template("apache/site.http.conf.erb"),
|
||||||
}
|
}
|
||||||
|
if $proxy == "" {
|
||||||
file { $site_confdir:
|
file { $site_confdir:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
mode => "0644",
|
mode => "0644",
|
||||||
owner => root,
|
owner => "root",
|
||||||
group => root,
|
group => "root",
|
||||||
purge => true,
|
purge => true,
|
||||||
force => true,
|
force => true,
|
||||||
recurse => true,
|
recurse => true,
|
||||||
|
@ -120,6 +117,7 @@ define apache::redhat::site($aliases, $root, $redirect, $proxy) {
|
||||||
notify => Service["httpd"],
|
notify => Service["httpd"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
<VirtualHost *:80>
|
|
||||||
ServerName <%= @site_fqdn %>
|
|
||||||
<% if @aliases != "" -%>
|
|
||||||
ServerAlias <%= @aliases %>
|
|
||||||
<% end -%>
|
|
||||||
ErrorLog /srv/www/log/http/<%= @site_fqdn %>/error_log
|
|
||||||
CustomLog /srv/www/log/http/<%= @site_fqdn %>/access_log combined
|
|
||||||
ProxyPass / <%= @proxy %>/
|
|
||||||
ProxyPassReverse / <%= @proxy %>/
|
|
||||||
</VirtualHost>
|
|
|
@ -5,6 +5,11 @@
|
||||||
<% end -%>
|
<% end -%>
|
||||||
ErrorLog /srv/www/log/http/<%= @site_fqdn %>/error_log
|
ErrorLog /srv/www/log/http/<%= @site_fqdn %>/error_log
|
||||||
CustomLog /srv/www/log/http/<%= @site_fqdn %>/access_log combined
|
CustomLog /srv/www/log/http/<%= @site_fqdn %>/access_log combined
|
||||||
|
<% if @proxy != "" -%>
|
||||||
|
ProxyPass / <%= @proxy %>/
|
||||||
|
ProxyPassReverse / <%= @proxy %>/
|
||||||
|
<% else -%>
|
||||||
DocumentRoot /srv/www/http/<%= @site_fqdn %>
|
DocumentRoot /srv/www/http/<%= @site_fqdn %>
|
||||||
Include <%= @site_confdir %>/*.conf
|
Include <%= @site_confdir %>/*.conf
|
||||||
|
<% end -%>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue