mirror of
https://github.com/DeanWard/CaddyGen.git
synced 2025-10-30 06:07:12 +00:00
Compare commits
3 Commits
69c6ba0089
...
4b9cb16f05
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b9cb16f05 | ||
|
|
6aab019c5f | ||
|
|
9355b200bb |
@@ -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)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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' : ''}`);
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -5,6 +5,7 @@ export interface CaddyHost {
|
||||
root: string;
|
||||
browse: boolean;
|
||||
php: boolean;
|
||||
frankenphp: boolean;
|
||||
hide: string[];
|
||||
};
|
||||
presetName?: string;
|
||||
|
||||
Reference in New Issue
Block a user