@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 127 lines 2.87 KB
Raw
1 :8884
2
3 # the use of a host matcher here should cause this
4 # site block to be wrapped in a subroute, even though
5 # the site block does not have a hostname; this is
6 # to prevent auto-HTTPS from picking up on this host
7 # matcher because it is not a key on the site block
8 @test host example.com
9 php_fastcgi @test localhost:9000
10 ----------
11 {
12 "apps": {
13 "http": {
14 "servers": {
15 "srv0": {
16 "listen": [
17 ":8884"
18 ],
19 "routes": [
20 {
21 "handle": [
22 {
23 "handler": "subroute",
24 "routes": [
25 {
26 "handle": [
27 {
28 "handler": "subroute",
29 "routes": [
30 {
31 "handle": [
32 {
33 "handler": "static_response",
34 "headers": {
35 "Location": [
36 "./{http.request.orig_uri.path.file_escaped}/{http.request.orig_uri.prefixed_query}"
37 ]
38 },
39 "status_code": 308
40 }
41 ],
42 "match": [
43 {
44 "file": {
45 "try_files": [
46 "{http.request.uri.path}/index.php"
47 ]
48 },
49 "not": [
50 {
51 "path": [
52 "*/"
53 ]
54 }
55 ]
56 }
57 ]
58 },
59 {
60 "handle": [
61 {
62 "handler": "rewrite",
63 "uri": "{http.matchers.file.relative}"
64 }
65 ],
66 "match": [
67 {
68 "file": {
69 "split_path": [
70 ".php"
71 ],
72 "try_files": [
73 "{http.request.uri.path}",
74 "{http.request.uri.path}/index.php",
75 "index.php"
76 ]
77 }
78 }
79 ]
80 },
81 {
82 "handle": [
83 {
84 "handler": "reverse_proxy",
85 "transport": {
86 "protocol": "fastcgi",
87 "split_path": [
88 ".php"
89 ]
90 },
91 "upstreams": [
92 {
93 "dial": "localhost:9000"
94 }
95 ]
96 }
97 ],
98 "match": [
99 {
100 "path": [
101 "*.php"
102 ]
103 }
104 ]
105 }
106 ]
107 }
108 ],
109 "match": [
110 {
111 "host": [
112 "example.com"
113 ]
114 }
115 ]
116 }
117 ]
118 }
119 ],
120 "terminal": true
121 }
122 ]
123 }
124 }
125 }
126 }
127 }