mirror of
https://github.com/digitalocean/nginxconfig.io.git
synced 2025-08-09 00:09:16 +08:00
Move generic PHP location block after specific rules (fixes #112)
This commit is contained in:
@@ -207,20 +207,6 @@ export default (domain, domains, global) => {
|
|||||||
serverConfig.push([`location ${domain.reverseProxy.path.computed}`, locConf]);
|
serverConfig.push([`location ${domain.reverseProxy.path.computed}`, locConf]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PHP
|
|
||||||
if (domain.php.php.computed) {
|
|
||||||
serverConfig.push(['# handle .php', '']);
|
|
||||||
|
|
||||||
const loc = `location ~ ${domain.routing.legacyPhpRouting.computed ? '[^/]\\.php(/|$)' : '\\.php$'}`;
|
|
||||||
if (global.tools.modularizedStructure.computed || domain.php.wordPressRules.computed) {
|
|
||||||
// Modularized
|
|
||||||
serverConfig.push([loc, { include: 'nginxconfig.io/php_fastcgi.conf' }]);
|
|
||||||
} else {
|
|
||||||
// Unified
|
|
||||||
serverConfig.push([loc, phpConf(domains, global)]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Additional config
|
// Additional config
|
||||||
if (global.tools.modularizedStructure.computed) {
|
if (global.tools.modularizedStructure.computed) {
|
||||||
// Modularized
|
// Modularized
|
||||||
@@ -245,6 +231,20 @@ export default (domain, domains, global) => {
|
|||||||
if (domain.php.magentoRules.computed) serverConfig.push(...Object.entries(magentoConf()));
|
if (domain.php.magentoRules.computed) serverConfig.push(...Object.entries(magentoConf()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PHP
|
||||||
|
if (domain.php.php.computed) {
|
||||||
|
serverConfig.push(['# handle .php', '']);
|
||||||
|
|
||||||
|
const loc = `location ~ ${domain.routing.legacyPhpRouting.computed ? '[^/]\\.php(/|$)' : '\\.php$'}`;
|
||||||
|
if (global.tools.modularizedStructure.computed || domain.php.wordPressRules.computed) {
|
||||||
|
// Modularized
|
||||||
|
serverConfig.push([loc, { include: 'nginxconfig.io/php_fastcgi.conf' }]);
|
||||||
|
} else {
|
||||||
|
// Unified
|
||||||
|
serverConfig.push([loc, phpConf(domains, global)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add the server config to the parent config now its built
|
// Add the server config to the parent config now its built
|
||||||
config.push(['server', serverConfig]);
|
config.push(['server', serverConfig]);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user