legacy PHP routing, fast_cgi fixes

pull/66/head
Szekeres Bálint 2018-12-18 23:26:57 +01:00
parent 1191637cc6
commit c25228ef53
5 changed files with 36 additions and 15 deletions

View File

@ -50,6 +50,7 @@
php: true,
php_server: '/var/run/php/php7.2-fpm.sock',
php_server_backup: '',
php_legacy_routing: false,
wordpress: false,
drupal: false,
magento: false,
@ -531,6 +532,10 @@
return $scope.data.fallback_php && $scope.isPHP();
};
$scope.isLegacyPHPRouting = function() {
return $scope.isPHP() && $scope.data.php_legacy_routing;
};
$scope.isPHP = function() {
return $scope.data.php;
};

View File

@ -538,6 +538,17 @@
ng-class="{ 'input-changed': data.fallback_php_path !== defaultData.fallback_php_path }">
</div>
</div>
<div class="form-group row" ng-if="isPHP()">
<label class="col-sm-3 col-form-label col-form-label-sm">
<span tooltips tooltip-template="Handle legacy (non-pretty) (<code>foo.php/bar/baz</code>) routes.">Legacy PHP routing</span>
</label>
<div class="col-sm-9">
<div class="form-check" ng-class="{ 'input-changed': data.php_legacy_routing !== defaultData.php_legacy_routing }">
<input class="form-check-input" type="checkbox" id="php_legacy_routing" ng-model="data.php_legacy_routing">
<label class="form-check-label" for="php_legacy_routing">enabled</label>
</div>
</div>
</div>
</div>
<div class="tab-pane tab-cache" ng-class="{ 'active': tab === 'cache' }">
<div class="form-group row">

View File

@ -1,17 +1,26 @@
<!--
✔ Legacy PHP routing --><span ng-if="isLegacyPHPRouting()"><!--
--># split path
fastcgi_split_path_info ^(.+\.php)(/.+)$;
set $_fastcgi_path_info $fastcgi_path_info;
</span><!--
--># 404
try_files $fastcgi_script_name =404;
# default fastcgi_params
include fastcgi_params;
# fastcgi settings
fastcgi_pass {{ !isPHPBackup() ? ((data.php_server[0] === '/' ? 'unix:' : '') + data.php_server) : 'php' }};
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass {{ !isPHPBackup() ? ((data.php_server[0] === '/' ? 'unix:' : '') + data.php_server) : 'php' }};
fastcgi_index index.php;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
# fastcgi params
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;<!--
✔ Legacy PHP routing --><span ng-if="isLegacyPHPRouting()">
fastcgi_param PATH_INFO $_fastcgi_path_info;</span>
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$base/:/usr/lib/php/:/tmp/";
fastcgi_intercept_errors off;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;

View File

@ -1,6 +1,5 @@
# WordPress: allow TinyMCE
location = /wp-includes/js/tinymce/wp-tinymce.php {
try_files $uri =404;
include nginxconfig.io/php_fastcgi.conf;
}
@ -32,6 +31,5 @@ location ~* ^/(?:xmlrpc\.php|wp-links-opml\.php|wp-config\.php|wp-config-sample\
# WordPress: throttle wp-login.php
location = /wp-login.php {
limit_req zone=login burst=2 nodelay;
try_files $uri =404;
include nginxconfig.io/php_fastcgi.conf;
}</span>

View File

@ -85,14 +85,12 @@ server {<!--
✔ PHP --><span ng-if="isPHP()">
# handle .php
location ~ \.php$ {
try_files $uri =404;<!--
location ~ {{ isLegacyPHPRouting() ? '[^/]\\.php(/|$)' : '\\.php$' }} {<!--
✔ modularized || ✔ WordPress --><span ng-if="isModularized() || isWordPress()">
include nginxconfig.io/php_fastcgi.conf;</span><!--
✔ unified && ✘ WordPress --><span ng-if="isUnified() && !isWordPress()">
<ng-include ng-include-tabs="{{ isUnified() ? 3 : 1 }}" src="'templates/conf/nginxconfig.io/php_fastcgi.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></ng-include></span>
}</span><!--