NameVirtualHost <%= @vhost_name %>:<%= @port %>
<VirtualHost <%= @vhost_name %>:<%= @port %>>
  <% if @ssl == true %>
  SSLEngine on
  SSLProtocol +TLSv1 +TLSv1.1 +TLSv1.2
  SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!EXP:!LOW:!MEDIUM
  SSLCertificateFile <%= @ssl_path %>/certs/pl.cert
  SSLCertificateKeyFile <%= @ssl_path %>/private/pl.key
  <% end %>
  ServerName <%= @srvname %>
<% if @serveraliases.is_a? Array %>
<% @serveraliases.each do |name| %><%= "  ServerAlias #{name}\n" %><% end %>
<% elsif @serveraliases != nil %>
<%= "  ServerAlias #{@serveraliases}" %>
<% end %>
   ProxyRequests Off
   <Proxy *>
     Order deny,allow
     Allow from all
    <IfVersion >= 2.4>
      Require all granted
    </IfVersion>
   </Proxy>

<% if @proxyexclusions.is_a? Array %>
        <% @proxyexclusions.each do |name| %><%= "    ProxyPass #{name} !\n" %><% end %>
<% elsif @proxyexclusions != nil %>
<%= "    ProxyPass #{@proxyexclusions} !" %>
<% end %>
   ProxyPass        / <%= @dest %>/
   ProxyPassReverse / <%= @dest %>/
   ProxyPreserveHost On 

<% if @proxyexclusions != nil and @docroot != nil %>
   DocumentRoot <%= @docroot %>
   <Directory <%= @docroot %>>
     Order deny,allow
     Allow from all
    <IfVersion >= 2.4>
      Require all granted
    </IfVersion>
   </Directory>
<% end %>
   ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_error.log
   LogLevel warn
   CustomLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_access.log combined

</VirtualHost>