feat: implement service management IPC handlers and add PHP configuration template
This commit is contained in:
@@ -41,6 +41,9 @@ max_file_uploads = 20
|
||||
allow_url_fopen = On
|
||||
allow_url_include = Off
|
||||
default_socket_timeout = 60
|
||||
session.save_path = "{{SESSION_DIR}}"
|
||||
upload_tmp_dir = "{{TEMP_DIR}}"
|
||||
sys_temp_dir = "{{TEMP_DIR}}"
|
||||
extension_dir = "{{EXT_DIR}}"
|
||||
|
||||
[ExtensionList]
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
87480
|
||||
48324
|
||||
|
||||
+17
-8
@@ -60,21 +60,22 @@ export function registerIpcHandlers(): void {
|
||||
const phpPort = portMappingService.getPhpPort(p.phpVersion)
|
||||
const normalizedPath = p.path.replace(/\\/g, '/')
|
||||
return `
|
||||
location = /${p.host} {
|
||||
return 301 /${p.host}/;
|
||||
}
|
||||
location /${p.host}/ {
|
||||
alias "${normalizedPath}/";
|
||||
index index.php index.html;
|
||||
try_files $uri $uri/ /${p.host}/index.php?$query_string;
|
||||
|
||||
location ~ ^/${p.host}/(?<rel_path>.+\.php)$ {
|
||||
# Sadece .php değil, URI'nin tamamını eşleştirip dosya adını $1 içine alıyoruz
|
||||
location ~ ^/${p.host}/(.*\.php)$ {
|
||||
fastcgi_pass 127.0.0.1:${phpPort};
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME "${normalizedPath}/$rel_path";
|
||||
|
||||
# Hatalı olan $request_filename yerine manuel path veriyoruz
|
||||
fastcgi_param SCRIPT_FILENAME "${normalizedPath}/$1";
|
||||
|
||||
include "${confDir.replace(/\\/g, '/')}/fastcgi_params";
|
||||
}
|
||||
}`
|
||||
}`
|
||||
}).join('\n')
|
||||
|
||||
const configPath = await configService.generateConfig('nginx.conf.template', 'nginx.conf', {
|
||||
@@ -108,12 +109,20 @@ export function registerIpcHandlers(): void {
|
||||
if (!binPath) return { success: false, message: `${phpVersion || ''} PHP executable bulunamadı. Lütfen indirin.` }
|
||||
|
||||
const phpPort = phpVersion ? portMappingService.getPhpPort(phpVersion) : settings.phpPort
|
||||
const extDir = path.join(path.dirname(binPath), 'ext')
|
||||
const extDir = path.join(path.dirname(binPath), 'ext').replace(/\\/g, '/')
|
||||
const gdExtName = fs.existsSync(path.join(extDir, 'php_gd2.dll')) ? 'gd2' : 'gd'
|
||||
|
||||
const sessionDir = path.join(configService.getBasePath(), 'data', 'sessions').replace(/\\/g, '/')
|
||||
const tempDir = path.join(configService.getBasePath(), 'data', 'temp').replace(/\\/g, '/')
|
||||
|
||||
if (!fs.existsSync(sessionDir)) fs.mkdirSync(sessionDir, { recursive: true })
|
||||
if (!fs.existsSync(tempDir)) fs.mkdirSync(tempDir, { recursive: true })
|
||||
|
||||
const configPath = await configService.generateConfig('php.ini.template', `php_${phpVersion || 'default'}.ini`, {
|
||||
EXT_DIR: extDir,
|
||||
GD_EXT: gdExtName
|
||||
GD_EXT: gdExtName,
|
||||
SESSION_DIR: sessionDir,
|
||||
TEMP_DIR: tempDir
|
||||
})
|
||||
|
||||
const success = await processManager.startService(serviceName, binPath, ['-b', `127.0.0.1:${phpPort}`, '-c', configPath], false)
|
||||
|
||||
Reference in New Issue
Block a user