Set default vhost in puppetlabs-apache

I am trying to configure apache using the puppet module and puppet-apache module ( https://github.com/puppetlabs/puppetlabs-apache ). Does anyone know if it is possible to change the default docroot vhost from / var / www to something like / var / www / default?

Thank!

+3
source share
2 answers

Yes, it is possible:

As seen from the vhost recipe ,

# Sample Usage:
#
# # Simple vhost definition:
# apache::vhost { 'site.name.fqdn':
# port => '80',
# docroot => '/path/to/docroot',
# }

By default, vhost docroot is OS-bound, so if you want to start the default host in some other directory, you must disable it using the default_vhost => Falseapache declaration and then declare the object apache::vhostwith the desired conf

apache{
   default_vhost => false,
   ...
}

apache::vhost{'mydefaulthost':
   docroot => '/var/www/other',
   ...
}
+3
source

, , .

( ):

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',
        },
    ],

}
+2

All Articles