Skip to content

Commit e41378e

Browse files
author
Till Brehm
committed
Merge branch 'patch-1' into 'master'
Let apache handle error document for php files that desn't exist and not fpm See merge request !531
2 parents 52b7de6 + bd95906 commit e41378e

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

server/conf/vhost.conf.master

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,24 @@
339339
</Directory>
340340
<Directory {tmpl_var name='web_document_root_www'}>
341341
<FilesMatch "\.php[345]?$">
342-
SetHandler php5-fcgi
342+
<tmpl_if name='apache_version' op='>=' value='2.4' format='version'>
343+
<If "-f %{DOCUMENT_ROOT} . '/' . %{REQUEST_URI}">
344+
SetHandler php5-fcgi
345+
</If>
346+
<tmpl_else>
347+
SetHandler php5-fcgi
348+
</tmpl_if>
343349
</FilesMatch>
344350
</Directory>
345351
<Directory {tmpl_var name='web_document_root'}>
346352
<FilesMatch "\.php[345]?$">
347-
SetHandler php5-fcgi
353+
<tmpl_if name='apache_version' op='>=' value='2.4' format='version'>
354+
<If "-f %{DOCUMENT_ROOT} . '/' . %{REQUEST_URI}">
355+
SetHandler php5-fcgi
356+
</If>
357+
<tmpl_else>
358+
SetHandler php5-fcgi
359+
</tmpl_if>
348360
</FilesMatch>
349361
</Directory>
350362
Action php5-fcgi /php5-fcgi virtual
@@ -361,15 +373,27 @@
361373
#ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ fcgi://127.0.0.1:<tmpl_var name='fpm_port'><tmpl_var name='web_document_root'>/$1
362374
<Directory {tmpl_var name='web_document_root'}>
363375
<FilesMatch "\.php[345]?$">
364-
SetHandler "proxy:fcgi://127.0.0.1:<tmpl_var name='fpm_port'>"
376+
<tmpl_if name='apache_version' op='>=' value='2.4' format='version'>
377+
<If "-f %{DOCUMENT_ROOT} . '/' . %{REQUEST_URI}">
378+
SetHandler "proxy:fcgi://127.0.0.1:<tmpl_var name='fpm_port'>"
379+
</If>
380+
<tmpl_else>
381+
SetHandler "proxy:fcgi://127.0.0.1:<tmpl_var name='fpm_port'>"
382+
</tmpl_if>
365383
</FilesMatch>
366384
</Directory>
367385
</tmpl_if>
368386
<tmpl_if name='use_socket'>
369387
#ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ unix://<tmpl_var name='fpm_socket'>|fcgi://localhost/<tmpl_var name='web_document_root'>/$1
370388
<Directory {tmpl_var name='web_document_root'}>
371389
<FilesMatch "\.php[345]?$">
372-
SetHandler "proxy:unix:<tmpl_var name='fpm_socket'>|fcgi://localhost"
390+
<tmpl_if name='apache_version' op='>=' value='2.4' format='version'>
391+
<If "-f %{DOCUMENT_ROOT} . '/' . %{REQUEST_URI}">
392+
SetHandler "proxy:unix:<tmpl_var name='fpm_socket'>|fcgi://localhost"
393+
</If>
394+
<tmpl_else>
395+
SetHandler "proxy:unix:<tmpl_var name='fpm_socket'>|fcgi://localhost"
396+
</tmpl_if>
373397
</FilesMatch>
374398
</Directory>
375399
</tmpl_if>

0 commit comments

Comments
 (0)