I’m trying to configure 1 webserver to host 2 different domains (example1.com and example2.com) I need both to listen on 80 and 443. There are no subdomains.
I’m using puppetlabs’s apache module with the following configuration:
class profiles::webserver1 {
include apache
#Create the user
user { 'example1':
ensure => present,
uid => 12120,
managehome => true,
}->
#Ensure mysql starts up
#class { '::mysql::server':
# service_enabled => true,
# }
apache::vhost { 'default':
ensure => false,
port => 80,
}
#install wordpress and configure mysql
wordpress::instance { '/opt/example1':
version => '4.1.1',
wp_owner => 'example1',
wp_group => 'example1',
db_user => 'example1',
db_name => 'example1',
db_password => 'thisshouldsuperbedone',
}->
#Install php
class { '::apache::mod::php':
content => '
AddHandler php5-script .php
AddType text/html .php',
}
#Enable mod_rewrite
#apache::mod { 'rewrite': }
#Create apache vhost
apache::vhost { 'example1.com':
port => '80',
docroot => '/opt/example1',
fallbackresource => '/index.php',
directories => [
{ path => '/opt/example1',
allow_override => ['AuthConfig', 'Indexes'],
},
],
}->
#Create ssl vhost
apache::vhost { 'ssl.example1.com':
port => '443',
docroot => '/opt/example1',
ssl => true,
}
##===second domain===##
#Create the user
user { 'example2':
ensure => present,
uid => 12121,
# managehome => true,
}->
#Create apache vhost
apache::vhost { 'example2.com':
port => '80',
docroot => '/opt/example2',
fallbackresource => '/index.php',
directories => [
{ path => '/opt/example2',
allow_override => ['AuthConfig', 'Indexes'],
},
],
}->
#Create ssl vhost
apache::vhost { 'ssl.example2.com':
port => '443',
docroot => '/opt/example2',
ssl => true,
}
}
My problem is, a file called 15-default.conf is being created and its matching when i try to reach the site via either domainname. If i do https:// then it takes me to the right domain content. If i go and manually delete the 15-default.conf and restart httpd everything works as expected.
Reading the module’s documentation i see:
Sets up a default virtual host. Defaults to 'true', set to 'false' to set up customized virtual hosts.
But I’m not sure how to write that out on the profile/manifest, if I do
apache::vhost { 'default':
ensure => false,
port => 80,
}
I get the following error:
Error: Duplicate declaration: Apache::Vhost[default] is already declared in file /etc/puppet/modules/apache/manifests/init.pp:361; cannot redeclare at /etc/puppet/modules/profiles/manifests/example1.pp:22 on node example2
How can i keep that default file being created and is this a “proper” way to try to setup the 2 vhosts in apache.
Thanks!
-Latina
default_mods => true,
default_vhost => false,
default_ssl_vhost => false,
--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/R10Bs99NPMU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/587916a6-a8c2-4273-9b7d-897b32e12c9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.