From 5b83945c4de7c7eb3719aaf29adc9e27157579e4 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sun, 24 Nov 2024 08:39:36 +0700 Subject: [PATCH] Fix FPM --- src/executor/nginx.js | 13 +++++++++---- src/executor/runnersub.js | 6 +++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/executor/nginx.js b/src/executor/nginx.js index 17b052a..e668ce7 100644 --- a/src/executor/nginx.js +++ b/src/executor/nginx.js @@ -203,6 +203,11 @@ class NginxExecutor { loc.location[loc.location.length - 1]._add('internal') } } + /** + * + * @param {import('nginx-conf/dist/src/conf').NginxConfItem} node + * @param {string} domain + */ extractInfo(node, domain) { const extractLocations = (node, info) => { const r = {}; @@ -355,12 +360,12 @@ class NginxExecutor { else if (ip === "80" || ip === "443") ip = ""; data[ip.startsWith("[") ? "ip6" : "ip"] = ip; - data.ssl |= x._value.includes("ssl") ? 2 : 1; + data.ssl |= ("" + x._value).includes("ssl") ? 2 : 1; }); if (node.http3?.[0]._value == "on") { data.http = 3; } - let servernames = (node.server_name[0]?._value || '').split(' '); + let servernames = ((node.server_name[0]?._value || '') + '').split(' '); let hasApex = servernames.includes(domain); let hasWww = servernames.includes('www.' + domain); data.www = (hasApex ? 1 : 0) + (hasWww ? 2 : 0); @@ -369,8 +374,8 @@ class NginxExecutor { data.home = `/home/${data.user}/`; data.access_log = node.access_log[0]?._value; data.error_log = node.error_log[0]?._value; - data.ssl_certificate = node.ssl_certificate[0]?._value || data.home + `ssl.cert`; - data.ssl_certificate_key = node.ssl_certificate_key[0]?._value || data.home + `ssl.key`; + data.ssl_certificate = node.ssl_certificate[0]?._value; + data.ssl_certificate_key = node.ssl_certificate_key[0]?._value; data.fcgi = findFastCgi(node); data.docker_ip = findDockerIp(node); diff --git a/src/executor/runnersub.js b/src/executor/runnersub.js index 490e683..1fdcd88 100644 --- a/src/executor/runnersub.js +++ b/src/executor/runnersub.js @@ -210,7 +210,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec, domain: subdomain, mode: 'none', }); - subdomain['PHP execution mode'] = 'none'; + subdomaindata['PHP execution mode'] = 'none'; await sshExec(`rm -f ~/.local/bin/php`, false); await writeLog("$> Updating nginx config"); const nginxNodes = await nginxExec.get(subdomain); @@ -221,13 +221,13 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec, await writeLog("$> Changing PHP engine to " + value); - if (subdomain['PHP execution mode'] == 'none') { + if (subdomaindata['PHP execution mode'] == 'none') { await virtExec("modify-web", { domain: subdomain, mode: 'fpm', 'php-fpm-mode': 'ondemand', }); - subdomain['PHP execution mode'] = 'fpm'; + subdomaindata['PHP execution mode'] = 'fpm'; } await virtExec("modify-web", {