Skip to content

Commit

Permalink
Fix FPM
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Nov 24, 2024
1 parent b92b28e commit 5b83945
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 9 additions & 4 deletions src/executor/nginx.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/executor/runnersub.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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", {
Expand Down

0 comments on commit 5b83945

Please sign in to comment.