feat: implement dynamic Nginx project configuration and IPC service management for PHP environments

This commit is contained in:
Ümit Tunç
2026-03-30 08:19:15 +03:00
parent 039d0a2782
commit c5d6635f01
2 changed files with 25 additions and 17 deletions
+8 -6
View File
@@ -61,21 +61,23 @@ async function rebuildNginxConfig(forceProjects: boolean = false): Promise<{ bin
// If file exists, check if it was manually edited
if (!shouldGenerate && fs.existsSync(projectConfPath)) {
const currentContent = fs.readFileSync(projectConfPath, 'utf8')
if (currentContent.includes('# MANUAL_EDIT')) {
shouldGenerate = false // Never overwrite manual edits during auto-rebuild
} else if (forceProjects) {
if (!currentContent.includes('# MANUAL_EDIT')) {
// Overwrite old, broken configs that don't have the marker
shouldGenerate = true
}
}
if (shouldGenerate) {
const phpPort = portMappingService.getPhpPort(p.phpVersion)
const normalizedPath = p.path.replace(/\\/g, '/')
// Ensure path ends with a slash for alias compatibility
const pathWithSlash = normalizedPath.endsWith('/') ? normalizedPath : `${normalizedPath}/`
let normalizedPath = p.path.replace(/\\/g, '/')
if (!normalizedPath.endsWith('/')) {
normalizedPath += '/'
}
await configService.generateConfig('nginx_project.conf.template', `projects/${p.host}.conf`, {
HOST: p.host,
PATH: pathWithSlash,
PATH: normalizedPath,
PHP_PORT: phpPort.toString(),
CONF_DIR: confDir.replace(/\\/g, '/')
})