Skip to content

Commit

Permalink
Add apache configuration customization layer (closes #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkphl committed Dec 11, 2017
1 parent e79cc59 commit 864ba2b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/Admin/Infrastructure/Persistence/Apache.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ public function __invoke(VhostInterface $vhost)
}

// Add the virtual host include
$this->addEntry($files, 'apache_vhost.include',
TemplateService::render('apache_vhost.include', $variables));
$this->addEntry($files, 'apache_vhost.include', TemplateService::render('apache_vhost.include', $variables));
$this->addEntry($files, 'apache_vhost_custom_directory.include?', TemplateService::render('apache_vhost_custom_directory.include', $variables));
$this->addEntry($files, 'apache_vhost_custom_all.include?', '');

// If the HTTPS protocol is supported
$httpsPorts = $vhost->getPorts(Vhost::PROTOCOL_HTTPS);
Expand Down Expand Up @@ -177,6 +178,7 @@ public function __invoke(VhostInterface $vhost)
$variables['ssl'] = false;
$this->addEntry($files, 'apache_vhost.conf',
TemplateService::render('apache_vhost.conf', $variables));
$this->addEntry($files, 'apache_vhost_custom_'.$httpPort.'.include?', '');
}

$absoluteFiles = [];
Expand Down
2 changes: 2 additions & 0 deletions src/Admin/Infrastructure/Templates/apache_vhost.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
Protocols h2 http/1.1{{#ssl}}
Include {{configroot}}/apache_ssl.include{{/ssl}}
Include {{configroot}}/apache_vhost.include
Include {{configroot}}/apache_vhost_custom_all.include
Include {{configroot}}/apache_vhost_custom_{{port}}.include
</VirtualHost>
8 changes: 1 addition & 7 deletions src/Admin/Infrastructure/Templates/apache_vhost.include
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ CustomLog {{logdir}}/access_{{primary_domain}}_log combined

DocumentRoot "{{docroot}}"
<Directory "{{docroot}}">
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]

Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
Include {{configroot}}/apache_vhost_directory.include
</Directory>{{#php_version}}

Include {{configroot}}/apache_fmp.include{{/php_version}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]

Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted

0 comments on commit 864ba2b

Please sign in to comment.