@marcel91200 / caddy Mirror · read-only
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 11, 01:00 UTC

master
caddyfiletest 260 lines 5.36 KB
Raw
1 {
2 http_port 2099
3 }
4 localhost:2099 {
5 root * /var/www/
6 file_server
7
8 handle_errors 404 {
9 handle /en/* {
10 respond "not found" 404
11 }
12 handle /es/* {
13 respond "no encontrado"
14 }
15 handle {
16 respond "default not found"
17 }
18 }
19 handle_errors {
20 handle /en/* {
21 respond "English error"
22 }
23 handle /es/* {
24 respond "Spanish error"
25 }
26 handle {
27 respond "Default error"
28 }
29 }
30 }
31 ----------
32 {
33 "apps": {
34 "http": {
35 "http_port": 2099,
36 "servers": {
37 "srv0": {
38 "listen": [
39 ":2099"
40 ],
41 "routes": [
42 {
43 "match": [
44 {
45 "host": [
46 "localhost"
47 ]
48 }
49 ],
50 "handle": [
51 {
52 "handler": "subroute",
53 "routes": [
54 {
55 "handle": [
56 {
57 "handler": "vars",
58 "root": "/var/www/"
59 },
60 {
61 "handler": "file_server",
62 "hide": [
63 "./Caddyfile"
64 ]
65 }
66 ]
67 }
68 ]
69 }
70 ],
71 "terminal": true
72 }
73 ],
74 "errors": {
75 "routes": [
76 {
77 "match": [
78 {
79 "host": [
80 "localhost"
81 ]
82 }
83 ],
84 "handle": [
85 {
86 "handler": "subroute",
87 "routes": [
88 {
89 "handle": [
90 {
91 "handler": "subroute",
92 "routes": [
93 {
94 "group": "group3",
95 "handle": [
96 {
97 "handler": "subroute",
98 "routes": [
99 {
100 "handle": [
101 {
102 "body": "not found",
103 "handler": "static_response",
104 "status_code": 404
105 }
106 ]
107 }
108 ]
109 }
110 ],
111 "match": [
112 {
113 "path": [
114 "/en/*"
115 ]
116 }
117 ]
118 },
119 {
120 "group": "group3",
121 "handle": [
122 {
123 "handler": "subroute",
124 "routes": [
125 {
126 "handle": [
127 {
128 "body": "no encontrado",
129 "handler": "static_response"
130 }
131 ]
132 }
133 ]
134 }
135 ],
136 "match": [
137 {
138 "path": [
139 "/es/*"
140 ]
141 }
142 ]
143 },
144 {
145 "group": "group3",
146 "handle": [
147 {
148 "handler": "subroute",
149 "routes": [
150 {
151 "handle": [
152 {
153 "body": "default not found",
154 "handler": "static_response"
155 }
156 ]
157 }
158 ]
159 }
160 ]
161 }
162 ]
163 }
164 ],
165 "match": [
166 {
167 "expression": "{http.error.status_code} in [404]"
168 }
169 ]
170 },
171 {
172 "handle": [
173 {
174 "handler": "subroute",
175 "routes": [
176 {
177 "group": "group8",
178 "handle": [
179 {
180 "handler": "subroute",
181 "routes": [
182 {
183 "handle": [
184 {
185 "body": "English error",
186 "handler": "static_response"
187 }
188 ]
189 }
190 ]
191 }
192 ],
193 "match": [
194 {
195 "path": [
196 "/en/*"
197 ]
198 }
199 ]
200 },
201 {
202 "group": "group8",
203 "handle": [
204 {
205 "handler": "subroute",
206 "routes": [
207 {
208 "handle": [
209 {
210 "body": "Spanish error",
211 "handler": "static_response"
212 }
213 ]
214 }
215 ]
216 }
217 ],
218 "match": [
219 {
220 "path": [
221 "/es/*"
222 ]
223 }
224 ]
225 },
226 {
227 "group": "group8",
228 "handle": [
229 {
230 "handler": "subroute",
231 "routes": [
232 {
233 "handle": [
234 {
235 "body": "Default error",
236 "handler": "static_response"
237 }
238 ]
239 }
240 ]
241 }
242 ]
243 }
244 ]
245 }
246 ]
247 }
248 ]
249 }
250 ],
251 "terminal": true
252 }
253 ]
254 }
255 }
256 }
257 }
258 }
259 }
260