dep updates/enable ssl_dyn_rec_enable/fix nginx in background/remove tempwrite

Signed-off-by: Zoey <zoey@z0ey.de>
This commit is contained in:
renovate[bot]
2023-06-16 14:16:51 +00:00
committed by Zoey
parent cd058f1382
commit c6ecb61c9b
16 changed files with 94 additions and 36 deletions

View File

@@ -5,6 +5,8 @@ const config = require('../lib/config');
const utils = require('../lib/utils');
const error = require('../lib/error');
const NgxPidFilePath = '/usr/local/nginx/logs/nginx.pid';
const internalNginx = {
/**
@@ -111,11 +113,21 @@ const internalNginx = {
/**
* @returns {Promise}
*/
reload: () => {
return internalNginx.test()
.then(() => {
logger.info('Restarting Nginx');
return utils.exec('kill $(cat /usr/local/nginx/logs/nginx.pid); nginx');
if (fs.existsSync(NgxPidFilePath)) {
const ngxPID = fs.readFileSync(NgxPidFilePath, 'utf8').trim();
if (ngxPID.length > 0) {
logger.info('Killing Nginx');
utils.exec(`kill ${ngxPID}`);
}
}
logger.info('Starting Nginx in three seconds');
setTimeout(() => {
utils.execfg('nginx');
}, 3000);
});
},
@@ -159,10 +171,10 @@ const internalNginx = {
{certificate: host.certificate}, host.locations[i]);
if (locationCopy.forward_host.indexOf('/') > -1) {
const splitted = locationCopy.forward_host.split('/');
const split = locationCopy.forward_host.split('/');
locationCopy.forward_host = splitted.shift();
locationCopy.forward_path = `/${splitted.join('/')}`;
locationCopy.forward_host = split.shift();
locationCopy.forward_path = `/${split.join('/')}`;
}
// eslint-disable-next-line