changeset 112:5967c1b18860 puppet-3.6

Make sure that we don't leak PHP source code if something breaks
author IBBoard <dev@ibboard.co.uk>
date Sat, 04 Jun 2016 14:06:15 +0100
parents 501afb45ffc7
children 34302ede8d87
files modules/website/files/conf.extra/html-php.conf modules/website/files/php.conf
diffstat 2 files changed, 33 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/modules/website/files/conf.extra/html-php.conf	Sat Jun 04 14:05:14 2016 +0100
+++ b/modules/website/files/conf.extra/html-php.conf	Sat Jun 04 14:06:15 2016 +0100
@@ -1,10 +1,18 @@
 # Make sure we have PHP
 Include conf.extra/php.conf
-#
-# Cause the PHP interpreter to handle files with a .html extension.
-#
-AddHandler php5-script .html
-AddType text/html .html
+
+<IfModule php7_module>
+	#
+	# Cause the PHP interpreter to handle files with a .html extension.
+	#
+	AddHandler php7-script .html
+	AddType text/html .html
 
-#If we're doing HTML files as PHP then swap the priority for directory indexing
-DirectoryIndex index.html index.php
+	#If we're doing HTML files as PHP then swap the priority for directory indexing
+	DirectoryIndex index.html index.php
+</IfModule>
+<IfModule !php7_module>
+	<FilesMatch "\.html$">
+	        Require all denied
+	</FilesMatch>
+</IfModule>
--- a/modules/website/files/php.conf	Sat Jun 04 14:05:14 2016 +0100
+++ b/modules/website/files/php.conf	Sat Jun 04 14:06:15 2016 +0100
@@ -11,20 +11,21 @@
   LoadModule php7_module modules/libphp7-zts.so
 </IfModule>
 
-#
-# Cause the PHP interpreter to handle files with a .php extension.
-#
-AddHandler php7-script .php
-AddType text/html .php
-
-#
-# Add index.php to the list of files that will be served as directory
-# indexes.
-#
-DirectoryIndex index.php
-
-#
-# Uncomment the following line to allow PHP to pretty-print .phps
-# files as PHP source code:
-#
-#AddType application/x-httpd-php-source .phps
+<IfModule php7_module>
+	#
+	# Cause the PHP interpreter to handle files with a .php extension.
+	#
+	AddHandler php7-script .php
+	AddType text/html .php
+	
+	#
+	# Add index.php to the list of files that will be served as directory
+	# indexes.
+	#
+	DirectoryIndex index.php
+</IfModule>
+<IfModule !php7_module>
+	<FilesMatch "\.php$">
+	        Require all denied
+	</FilesMatch>
+</IfModule>
\ No newline at end of file