I have an Apache(2.4) webserver and a php (7.1) server running on Ubuntu 16.04 LTS. I am trying to setup a puppet manifest to create a vhost on the apache server and then each time a php server request is received by the webserver, the apache server would proxy the request to the php server and then read the requested page from the document root to display the request page. The document root is shared by both the webserver and the php server. A php fpm pool has been setup on the php server to listen for the proxy request from the apache server on port 9001. When I run "puppet agent -t", i don't get any errors and the vhost is created successfully. Once the vhost is created, I then create a php file called info.php with this code but for some reason, when I open a browser and type the vhost name in the url (example.com/info.php) nothing shows in the page. What I'm I doing wrong? below is the puppet manifest that I'm using.
class team::vhost {
#Create the base web directory and the vhosts for the wesbite
file { ['/var/wwws', '/var/wwws/web']:
ensure => 'directory',
}
#Create non-ssl vhost
apache::vhost { 'example.com non-ssl':
#ensure => 'absent',
servername => 'example.com',
serveradmin => 'localhost@example.com',
serveraliases => [
'www.example.com',
],
docroot => '/var/wwws/web',
port => '80',
rewrites => [
{
comment => 'Rewrite all non-ssl requests to ssl',
rewrite_cond => ['%{HTTPS} off'],
rewrite_rule => ['/(.*) https://%{SERVER_NAME}/$1 [R,L]'],
}
],
require => [
File['/var/wwws/web'],
]
}
#Create ssl vhost
apache::vhost { 'example.com ssl':
#ensure => 'absent',
servername => 'example.com',
serveradmin => 'localhost@example.com',
serveraliases => [
'www.example.com',
],
port => '443',
docroot => '/var/wwws/web',
ssl => true,
directories => [
{
path => '/var/wwws/web',
provider => 'directory',
rewrites => [
{
comment => 'Redirect non-file requests to our application',
rewrite_cond => [
'%{REQUEST_FILENAME} !-f',
'%{REQUEST_FILENAME} !-d',
],
rewrite_rule => ['^(.*)$ /info.php [QSA,L]'],
}
],
directoryindex => 'info.php',
options => ['-MultiViews', '+Indexes', '+FollowSymLinks'],
},
{
'path' => '\.php$',
'provider' => 'filesmatch',
'sethandler' => 'proxy:fcgi://192.168.2.4:9001'
}
],
require => [
File['/var/wwws/web']
]
}
}