example42/puppet-php

Got Apache2 Ubuntu Default Page

Closed this issue · 2 comments

I am using Vagrant and Puppet Provisioner to setup nginx and php in ubuntu/trusty64 box. But the thing I got was Apache2 Ubuntu Default Page and is really shocking. I am using following modules:

# Puppetlabs Modules
apt -> git@github.com:puppetlabs/puppetlabs-apt.git
concat -> git@github.com:puppetlabs/puppetlabs-concat.git
stdlib -> git@github.com:puppetlabs/puppetlabs-stdlib.git

# Example42 Modules
puppi -> git@github.com:example42/puppi.git
nginx -> git@github.com:netmanager/nginx.git
php -> git@github.com:example42/puppet-php.git # This installed apache2

In my manifests init.pp, I have coded like this.

group { 'puppet': ensure => present }

Exec { path => [ '/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/' ] }
File { owner => 0, group => 0, mode => 0644 }

class { 'apt':
    always_apt_update => true,
}

Class['::apt::update'] -> Package <|
    title != 'python-software-properties'
    and title != 'software-properties-common'
|>

# Package Configurations.
$sysPackages = ['vim', 'ntp']
package { $sysPackages:
    ensure => 'installed',
}

# Nginx Web-Server Configurations.
class { 'nginx':
    worker_connections      => 4096,
    keepalive_timeout       => 120,
    client_max_body_size    => '1024m',
    types_hash_max_size     => '2048',
}

nginx::resource::vhost { 'axisthemes.dev' :
    ipv6_enable => true,
    default_server => true,
    fastcgi => present,
    www_root => '/var/www/axisthemes',
}

# PHP Module Configurations.
class { 'php':
    service => 'nginx',
}

class { 'php::devel':
    require => Class['php'],
}

$phpModules = ['fpm', 'gd', 'imagick', 'mysql', 'cli', 'common', 'curl', 'intl', 'mcrypt', 'cgi', 'memcache']
php::module { $phpModules: }

$peclModules = ['xdebug']
php::pecl::module { $peclModules: }

In my Vagrantfile I have set this code:

config.vm.network "private_network", ip: "192.168.66.101"

Now whenever I browse to 192.168.66.101 I receive the Welcome to nginx! page but
if I browse 'axisthemes.dev` I receive Apache2 Ubuntu Default Page.

(Note)
I have check and found that apache2 was installed through this puppet-php module.
I am Nginx lover and really don't prefer apache. Also I love example42 modules. What was the case I didn't understand.

I must admit that the module has not been tested with nginx.
I reproduced the same issue, and either the apache packages is installed as a dependency by the php package or it was already there, since the code in the module, at least under ubuntu, has not references to apache packages, and actually if you stop the apache service and run puppet again nothing changes. So you might end up with a quick fix like disabling he apache service via puppet.

Got the problem Solved:

# +1 Example42 Modules
apache -> git@github.com:example42/puppet-apache.git

In my manifests init.pp, I have added few tweaks to disable apache services and looks like this:

group { 'puppet': ensure => present }

Exec { path => [ '/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/' ] }
File { owner => 0, group => 0, mode => 0644 }

class { 'apt':
    always_apt_update => true,
}

Class['::apt::update'] -> Package <|
    title != 'python-software-properties'
    and title != 'software-properties-common'
|>

# Package Configurations.
$sysPackages = ['vim', 'ntp']
package { $sysPackages:
    ensure => 'installed',
}

# Apache Web-Server Configurations.
class { 'apache':
  disable => true # Disable apache service.
}

# Nginx Web-Server Configurations.
class { 'nginx':
    worker_connections      => 4096,
    keepalive_timeout       => 120,
    client_max_body_size    => '1024m',
    types_hash_max_size     => '2048',
}

nginx::resource::vhost { 'axisthemes.dev' :
    ipv6_enable => true,
    default_server => true,
    fastcgi => present,
    www_root => '/var/www/axisthemes',
}

# PHP Module Configurations.
class { 'php':
    service => 'nginx',
}

class { 'php::devel':
    require => Class['php'],
}

$phpModules = ['fpm', 'gd', 'imagick', 'mysql', 'cli', 'common', 'curl', 'intl', 'mcrypt', 'cgi', 'memcache']
php::module { $phpModules: }

$peclModules = ['xdebug']
php::pecl::module { $peclModules: }