mirror of
https://github.com/DeanWard/CaddyGen.git
synced 2025-12-11 18:35:39 +00:00
feat: add support for FrankenPHP
This commit is contained in:
@@ -14,7 +14,7 @@ CaddyGen is a user-friendly web interface for generating [Caddy server](https://
|
|||||||
- 🛡️ Advanced **security options** (CSP, rate limiting, IP filtering)
|
- 🛡️ Advanced **security options** (CSP, rate limiting, IP filtering)
|
||||||
- ⚡ **Performance optimizations** (compression, caching)
|
- ⚡ **Performance optimizations** (compression, caching)
|
||||||
- 🌐 **CORS configuration**
|
- 🌐 **CORS configuration**
|
||||||
- 📁 File server options (directory listing, PHP support)
|
- 📁 File server options (directory listing, PHP and FrankenPHP support)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -198,10 +198,11 @@ function importHosts(newHosts: CaddyHost[]) {
|
|||||||
</div>
|
</div>
|
||||||
<span v-if="host.fileServer" class="block mt-1 text-sm">
|
<span v-if="host.fileServer" class="block mt-1 text-sm">
|
||||||
{{ host.fileServer.root }}
|
{{ host.fileServer.root }}
|
||||||
<span v-if="host.fileServer.browse || host.fileServer.php" class="text-white/60">
|
<span v-if="host.fileServer.browse || host.fileServer.php || host.fileServer.frankenphp" class="text-white/60">
|
||||||
({{ [
|
({{ [
|
||||||
host.fileServer.browse ? 'Browse' : null,
|
host.fileServer.browse ? 'Browse' : null,
|
||||||
host.fileServer.php ? 'PHP' : null
|
host.fileServer.php ? 'PHP' : null,
|
||||||
|
host.fileServer.frankenphp ? 'FrankenPHP' : null,
|
||||||
].filter(Boolean).join(', ') }})
|
].filter(Boolean).join(', ') }})
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ onMounted(() => {
|
|||||||
greedy: true
|
greedy: true
|
||||||
},
|
},
|
||||||
'directive': {
|
'directive': {
|
||||||
pattern: /^\s*(root|file_server|reverse_proxy|encode|tls|basicauth|header|php_fastcgi|rate_limit|respond|remote_ip|hide|not|forward_auth|uri|copy_headers)\b/m,
|
pattern: /^\s*(root|file_server|reverse_proxy|encode|tls|basicauth|header|php_fastcgi|php_server|rate_limit|respond|remote_ip|hide|not|forward_auth|uri|copy_headers)\b/m,
|
||||||
alias: 'keyword'
|
alias: 'keyword'
|
||||||
},
|
},
|
||||||
'block': {
|
'block': {
|
||||||
@@ -65,7 +65,7 @@ onMounted(() => {
|
|||||||
alias: 'operator'
|
alias: 'operator'
|
||||||
},
|
},
|
||||||
'option': {
|
'option': {
|
||||||
pattern: /\b(browse|internal|gzip|brotli|php_fastcgi|uri|copy_headers)\b/,
|
pattern: /\b(browse|internal|gzip|brotli|php_fastcgi|php_server|uri|copy_headers)\b/,
|
||||||
alias: 'property'
|
alias: 'property'
|
||||||
},
|
},
|
||||||
'number': {
|
'number': {
|
||||||
@@ -102,11 +102,19 @@ const caddyConfig = computed(() => {
|
|||||||
lines.push(`# ${host.presetName}`);
|
lines.push(`# ${host.presetName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (host.fileServer && host.fileServer.frankenphp) {
|
||||||
|
lines.push('{');
|
||||||
|
lines.push(' frankenphp');
|
||||||
|
lines.push('}');
|
||||||
|
}
|
||||||
|
|
||||||
lines.push(`${host.domain} {`);
|
lines.push(`${host.domain} {`);
|
||||||
|
|
||||||
if (host.fileServer) {
|
if (host.fileServer) {
|
||||||
lines.push(` root * ${host.fileServer.root}`);
|
lines.push(` root * ${host.fileServer.root}`);
|
||||||
if (host.fileServer.php) {
|
if (host.fileServer.frankenphp) {
|
||||||
|
lines.push(' php_server');
|
||||||
|
} else if (host.fileServer.php) {
|
||||||
lines.push(' php_fastcgi unix//run/php/php-fpm.sock');
|
lines.push(' php_fastcgi unix//run/php/php-fpm.sock');
|
||||||
}
|
}
|
||||||
lines.push(` file_server${host.fileServer.browse ? ' browse' : ''}`);
|
lines.push(` file_server${host.fileServer.browse ? ' browse' : ''}`);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const host = ref<CaddyHost>(props.initialHost || {
|
|||||||
root: '',
|
root: '',
|
||||||
browse: false,
|
browse: false,
|
||||||
php: false,
|
php: false,
|
||||||
|
frankenphp: false,
|
||||||
hide: []
|
hide: []
|
||||||
},
|
},
|
||||||
gzip: false,
|
gzip: false,
|
||||||
@@ -72,6 +73,7 @@ function handleServerTypeChange(event: Event) {
|
|||||||
root: '/var/www/html',
|
root: '/var/www/html',
|
||||||
browse: false,
|
browse: false,
|
||||||
php: false,
|
php: false,
|
||||||
|
frankenphp: false,
|
||||||
hide: []
|
hide: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -139,6 +141,13 @@ function applyPreset(preset: PresetConfig) {
|
|||||||
Enable PHP support
|
Enable PHP support
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group" v-if="host.fileServer.php || host.fileServer.frankenphp">
|
||||||
|
<label class="checkbox">
|
||||||
|
<input type="checkbox" v-model="host.fileServer.frankenphp" />
|
||||||
|
Enable <a href="https://frankenphp.dev">FrankenPHP</a>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="serverType === ''">
|
<template v-if="serverType === ''">
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ function parseCaddyfile(content: string): CaddyHost[] {
|
|||||||
root,
|
root,
|
||||||
browse: false,
|
browse: false,
|
||||||
php: false,
|
php: false,
|
||||||
|
frankenphp: false,
|
||||||
hide: []
|
hide: []
|
||||||
};
|
};
|
||||||
} else if (line.startsWith('file_server')) {
|
} else if (line.startsWith('file_server')) {
|
||||||
@@ -74,6 +75,7 @@ function parseCaddyfile(content: string): CaddyHost[] {
|
|||||||
root: '/',
|
root: '/',
|
||||||
browse: line.includes('browse'),
|
browse: line.includes('browse'),
|
||||||
php: false,
|
php: false,
|
||||||
|
frankenphp: false,
|
||||||
hide: []
|
hide: []
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export interface CaddyHost {
|
|||||||
root: string;
|
root: string;
|
||||||
browse: boolean;
|
browse: boolean;
|
||||||
php: boolean;
|
php: boolean;
|
||||||
|
frankenphp: boolean;
|
||||||
hide: string[];
|
hide: string[];
|
||||||
};
|
};
|
||||||
presetName?: string;
|
presetName?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user