Compare commits

...

3 Commits

Author SHA1 Message Date
Dean Ward
4b9cb16f05 Merge branch 'main' into fix/encode 2025-01-11 11:55:41 +00:00
Dean Ward
6aab019c5f Merge pull request #5 from dunglas/feat/frankenphp
feat: add support for FrankenPHP
2025-01-11 11:23:06 +00:00
Kévin Dunglas
9355b200bb feat: add support for FrankenPHP 2025-01-10 22:52:11 +01:00
6 changed files with 29 additions and 8 deletions

View File

@@ -14,7 +14,7 @@ CaddyGen is a user-friendly web interface for generating [Caddy server](https://
- 🛡️ Advanced **security options** (CSP, rate limiting, IP filtering)
-**Performance optimizations** (compression, caching)
- 🌐 **CORS configuration**
- 📁 File server options (directory listing, PHP support)
- 📁 File server options (directory listing, PHP and FrankenPHP support)
---

View File

@@ -198,10 +198,11 @@ function importHosts(newHosts: CaddyHost[]) {
</div>
<span v-if="host.fileServer" class="block mt-1 text-sm">
{{ 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.php ? 'PHP' : null
host.fileServer.php ? 'PHP' : null,
host.fileServer.frankenphp ? 'FrankenPHP' : null,
].filter(Boolean).join(', ') }})
</span>
</span>

View File

@@ -23,7 +23,7 @@ onMounted(() => {
greedy: true
},
'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'
},
'block': {
@@ -65,7 +65,7 @@ onMounted(() => {
alias: 'operator'
},
'option': {
pattern: /\b(browse|internal|encode|brotli|php_fastcgi|uri|copy_headers)\b/,
pattern: /\b(browse|internal|gzip|brotli|php_fastcgi|php_server|uri|copy_headers)\b/,
alias: 'property'
},
'number': {
@@ -101,12 +101,20 @@ const caddyConfig = computed(() => {
if (host.presetName) {
lines.push(`# ${host.presetName}`);
}
if (host.fileServer && host.fileServer.frankenphp) {
lines.push('{');
lines.push(' frankenphp');
lines.push('}');
}
lines.push(`${host.domain} {`);
if (host.fileServer) {
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(` file_server${host.fileServer.browse ? ' browse' : ''}`);

View File

@@ -20,6 +20,7 @@ const host = ref<CaddyHost>(props.initialHost || {
root: '',
browse: false,
php: false,
frankenphp: false,
hide: []
},
encode: false,
@@ -72,6 +73,7 @@ function handleServerTypeChange(event: Event) {
root: '/var/www/html',
browse: false,
php: false,
frankenphp: false,
hide: []
};
}
@@ -137,6 +139,13 @@ function applyPreset(preset: PresetConfig) {
<label class="checkbox">
<input type="checkbox" v-model="host.fileServer.php" />
Enable PHP support
</label>
</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>
@@ -307,7 +316,7 @@ function applyPreset(preset: PresetConfig) {
<!-- Performance Section -->
<div class="advanced-section">
<h3 class="text-lg font-semibold mb-4">Performance</h3>
<div class="form-group">
<label class="checkbox">
<input type="checkbox" v-model="host.performance.brotli" />

View File

@@ -66,6 +66,7 @@ function parseCaddyfile(content: string): CaddyHost[] {
root,
browse: false,
php: false,
frankenphp: false,
hide: []
};
} else if (line.startsWith('file_server')) {
@@ -74,6 +75,7 @@ function parseCaddyfile(content: string): CaddyHost[] {
root: '/',
browse: line.includes('browse'),
php: false,
frankenphp: false,
hide: []
};
} else {

View File

@@ -5,6 +5,7 @@ export interface CaddyHost {
root: string;
browse: boolean;
php: boolean;
frankenphp: boolean;
hide: string[];
};
presetName?: string;