feat: implement dynamic Nginx project configuration and IPC service management for PHP environments
This commit is contained in:
@@ -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, '/')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user