Skip to content

Commit 3bc1e1d

Browse files
author
Marius Cramer
committed
Removed usage of AddHandler in apache vhost config
- Reason: AddHandler fcgid-script .php does not only parse .php files, but all .php.* (e. g. .php.txt, .php.test etc.)
1 parent 9cb6fe1 commit 3bc1e1d

File tree

4 files changed

+33
-14
lines changed

4 files changed

+33
-14
lines changed

install/tpl/apache_apps.vhost.master

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
<Directory {tmpl_var name='apps_vhost_dir'}>
3737
Options +Indexes +FollowSymLinks +MultiViews +ExecCGI
3838
AllowOverride AuthConfig Indexes Limit Options FileInfo
39-
AddHandler fcgid-script .php
39+
<FilesMatch "\.php$">
40+
SetHandler fcgid-script
41+
</FilesMatch>
4042
FCGIWrapper {tmpl_var name='apps_vhost_basedir'}/php-fcgi-scripts/apps/.php-fcgi-starter .php
4143
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
4244
Require all granted

install/tpl/apache_ispconfig.vhost.master

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ NameVirtualHost *:<tmpl_var name="vhost_port">
2020
<Directory /var/www/ispconfig/>
2121
Options -Indexes +FollowSymLinks +MultiViews +ExecCGI
2222
AllowOverride AuthConfig Indexes Limit Options FileInfo
23-
AddHandler fcgid-script .php
23+
<FilesMatch "\.php$">
24+
SetHandler fcgid-script
25+
</FilesMatch>
2426
FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php
2527
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
2628
Require all granted

server/conf/apache_apps.vhost.master

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
<Directory {tmpl_var name='apps_vhost_dir'}>
3737
Options +Indexes +FollowSymLinks +MultiViews +ExecCGI
3838
AllowOverride AuthConfig Indexes Limit Options FileInfo
39-
AddHandler fcgid-script .php
39+
<FilesMatch "\.php$">
40+
SetHandler fcgid-script
41+
</FilesMatch>
4042
FCGIWrapper {tmpl_var name='apps_vhost_basedir'}/php-fcgi-scripts/apps/.php-fcgi-starter .php
4143
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
4244
Require all granted

server/conf/vhost.conf.master

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@
156156
<tmpl_if name='python' op='==' value='y'>
157157
<IfModule mod_python.c>
158158
<Directory {tmpl_var name='web_document_root_www'}>
159-
AddHandler mod_python .py
159+
<FilesMatch "\.py$">
160+
SetHandler mod_python
161+
</FilesMatch>
160162
PythonHandler mod_python.publisher
161163
PythonDebug On
162164
</Directory>
@@ -174,8 +176,9 @@
174176
</tmpl_if>
175177
</Directory>
176178
ScriptAlias /cgi-bin/ <tmpl_var name='document_root'>/cgi-bin/
177-
AddHandler cgi-script .cgi
178-
AddHandler cgi-script .pl
179+
<FilesMatch "\.(cgi|pl)$">
180+
SetHandler cgi-script
181+
</FilesMatch>
179182
</tmpl_if>
180183
<tmpl_if name='suexec' op='==' value='y'>
181184
# suexec enabled
@@ -202,21 +205,25 @@
202205
# suphp enabled
203206
<Directory {tmpl_var name='web_document_root'}>
204207
<IfModule mod_suphp.c>
205-
suPHP_Engine on
206-
# suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
208+
suPHP_Engine on
209+
# suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
207210
<tmpl_if name='has_custom_php_ini'>
208211
suPHP_ConfigPath <tmpl_var name='custom_php_ini_dir'>
209212
</tmpl_if>
210-
AddHandler x-httpd-suphp .php .php3 .php4 .php5
211-
suPHP_AddHandler x-httpd-suphp
213+
<FilesMatch "\.php[345]?$">
214+
SetHandler x-httpd-suphp
215+
</FilesMatch>
216+
suPHP_AddHandler x-httpd-suphp
212217
</IfModule>
213218
</Directory>
214219
</tmpl_if>
215220
<tmpl_if name='php' op='==' value='cgi'>
216221
# php as cgi enabled
217222
ScriptAlias /php5-cgi <tmpl_var name='cgi_starter_path'><tmpl_var name='cgi_starter_script'>
218223
Action php5-cgi /php5-cgi
219-
AddHandler php5-cgi .php .php3 .php4 .php5
224+
<FilesMatch "\.php[345]?$">
225+
SetHandler php5-cgi
226+
</FilesMatch>
220227
<Directory {tmpl_var name='cgi_starter_path'}>
221228
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
222229
Require all granted
@@ -253,7 +260,9 @@
253260
</tmpl_if>
254261
</IfModule>
255262
<Directory {tmpl_var name='web_document_root_www'}>
256-
AddHandler fcgid-script .php .php3 .php4 .php5
263+
<FilesMatch "\.php[345]?$">
264+
SetHandler fcgid-script
265+
</FilesMatch>
257266
FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php
258267
FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php3
259268
FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php4
@@ -268,7 +277,9 @@
268277
</tmpl_if>
269278
</Directory>
270279
<Directory {tmpl_var name='web_document_root'}>
271-
AddHandler fcgid-script .php .php3 .php4 .php5
280+
<FilesMatch "\.php[345]?$">
281+
SetHandler fcgid-script
282+
</FilesMatch>
272283
FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php
273284
FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php3
274285
FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php4
@@ -293,7 +304,9 @@
293304
Allow from all
294305
</tmpl_if>
295306
</Directory>
296-
AddHandler php5-fcgi .php .php3 .php4 .php5
307+
<FilesMatch "\.php[345]?$">
308+
SetHandler php5-fcgi
309+
</FilesMatch>
297310
Action php5-fcgi /php5-fcgi
298311
Alias /php5-fcgi {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'}
299312
<tmpl_if name='use_tcp'>

0 commit comments

Comments
 (0)