-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaddyfile.example
More file actions
executable file
·76 lines (68 loc) · 2.01 KB
/
Caddyfile.example
File metadata and controls
executable file
·76 lines (68 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
# Global options
frankenphp {
num_threads 8
php_ini {
memory_limit 512M
max_execution_time 15
opcache.enable 1
opcache.enable_cli 1
opcache.memory_consumption 256
opcache.interned_strings_buffer 16
opcache.jit_buffer_size 64M
opcache.jit tracing
}
}
servers {
trusted_proxies static 0.0.0.0
}
auto_https off
}
http://localhost:8000 {
# Root (Gunakan tanda bintang)
root * ./public/
# LOGGING (Sangat penting untuk debug)
log
encode zstd br gzip {
minimum_length 1
}
# PRIORITAS UTAMA: API Worker
# Menggunakan handle_path agar awalan /api otomatis terdeteksi
handle_path /api/* {
rewrite * /api.php
php_server {
worker {
file ./public/api.php
num 4
# Watch perubahan isi file
watch ./app/**/*.php ./config/**/*.php ./views/**/*.php ./static/**/*.php ./public/api.php
}
}
}
# PRIORITAS KEDUA: Web/HTMX (index.php)
handle {
# Cek apakah file fisik ada (css, js, images)
# Jika tidak ada, arahkan ke index.php
try_files {path} /index.php
php_server {
# Opsional: Jika index.php juga ingin jadi worker
# worker {
# file ./public/index.php
# num 3
# watch ./app/**/*.php ./views/**/*.php ./public/index.php
# }
}
}
# CORS Headers
header {
Access-Control-Allow-Origin "localhost,demo.test,demo.local,demo.app.com,192.168.0.100,[::1],127.0.0.1"
Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS"
Access-Control-Allow-Headers "Content-Type, X-Api-Key, HX-Request, HX-Trigger, HX-Target, HX-Current-URL"
Access-Control-Allow-Credentials "true"
Vary Origin
}
@options {
method OPTIONS
}
respond @options 204
}