I'm trying to configure apache using puppet and puppetlabs-apache module (https://github.com/puppetlabs/puppetlabs-apache). Does anyone know is it possible to change docroot of default vhost from /var/www to something like /var/www/default?
Thanks!
I'm trying to configure apache using puppet and puppetlabs-apache module (https://github.com/puppetlabs/puppetlabs-apache). Does anyone know is it possible to change docroot of default vhost from /var/www to something like /var/www/default?
Thanks!
Yes, it is possible:
As seen in vhost recipe,
# Sample Usage:
#
# # Simple vhost definition:
# apache::vhost { 'site.name.fqdn':
# port => '80',
# docroot => '/path/to/docroot',
# }
Default vhost docroot is bounded to the OS, so if you want to run default host in some other directory, you should disable it using default_vhost => False
in the apache declaration, and then declare a apache::vhost
object with your desired conf
apache{
default_vhost => false,
...
}
apache::vhost{'mydefaulthost':
docroot => '/var/www/other',
...
}
If you don't have a default vhost it will pick the vhost alphabetically sorted first one.
This works for me (leaving some authentication and alias usage bits in the snippet as well):
class {'apache':
default_vhost => false,
}
apache::vhost {'mydefault':
port => 443,
ssl => true,
#port => 80,
#ssl => false,
docroot => '/var/www/html',
directories => [
{
'path' => '/var/www/html',
'provider' => 'files',
},
{
'path' => '/media/builds',
'options' => 'Indexes FollowSymLinks MultiViews',
'allowoverride' => 'None',
'auth_type' => 'Basic',
'auth_name' => 'myrobotaccessonly',
'auth_basic_provider' => 'file',
'auth_user_file' => '/var/www/.mypasswdfile',
'auth_require' => 'user myrobotuser',
},
],
aliases => [
{
alias => '/builds',
path => '/media/builds',
},
],
}