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
| 1 | :8884 |
| 2 | |
| 3 | php_fastcgi localhost:9000 { |
| 4 | # some php_fastcgi-specific subdirectives |
| 5 | split .php .php5 |
| 6 | env VAR1 value1 |
| 7 | env VAR2 value2 |
| 8 | root /var/www |
| 9 | index index.php5 |
| 10 | |
| 11 | # passed through to reverse_proxy (directive order doesn't matter!) |
| 12 | lb_policy random |
| 13 | } |
| 14 | ---------- |
| 15 | { |
| 16 | "apps": { |
| 17 | "http": { |
| 18 | "servers": { |
| 19 | "srv0": { |
| 20 | "listen": [ |
| 21 | ":8884" |
| 22 | ], |
| 23 | "routes": [ |
| 24 | { |
| 25 | "match": [ |
| 26 | { |
| 27 | "file": { |
| 28 | "try_files": [ |
| 29 | "{http.request.uri.path}/index.php5" |
| 30 | ] |
| 31 | }, |
| 32 | "not": [ |
| 33 | { |
| 34 | "path": [ |
| 35 | "*/" |
| 36 | ] |
| 37 | } |
| 38 | ] |
| 39 | } |
| 40 | ], |
| 41 | "handle": [ |
| 42 | { |
| 43 | "handler": "static_response", |
| 44 | "headers": { |
| 45 | "Location": [ |
| 46 | "./{http.request.orig_uri.path.file_escaped}/{http.request.orig_uri.prefixed_query}" |
| 47 | ] |
| 48 | }, |
| 49 | "status_code": 308 |
| 50 | } |
| 51 | ] |
| 52 | }, |
| 53 | { |
| 54 | "match": [ |
| 55 | { |
| 56 | "file": { |
| 57 | "try_files": [ |
| 58 | "{http.request.uri.path}", |
| 59 | "{http.request.uri.path}/index.php5", |
| 60 | "index.php5" |
| 61 | ], |
| 62 | "split_path": [ |
| 63 | ".php", |
| 64 | ".php5" |
| 65 | ] |
| 66 | } |
| 67 | } |
| 68 | ], |
| 69 | "handle": [ |
| 70 | { |
| 71 | "handler": "rewrite", |
| 72 | "uri": "{http.matchers.file.relative}" |
| 73 | } |
| 74 | ] |
| 75 | }, |
| 76 | { |
| 77 | "match": [ |
| 78 | { |
| 79 | "path": [ |
| 80 | "*.php", |
| 81 | "*.php5" |
| 82 | ] |
| 83 | } |
| 84 | ], |
| 85 | "handle": [ |
| 86 | { |
| 87 | "handler": "reverse_proxy", |
| 88 | "load_balancing": { |
| 89 | "selection_policy": { |
| 90 | "policy": "random" |
| 91 | } |
| 92 | }, |
| 93 | "transport": { |
| 94 | "env": { |
| 95 | "VAR1": "value1", |
| 96 | "VAR2": "value2" |
| 97 | }, |
| 98 | "protocol": "fastcgi", |
| 99 | "root": "/var/www", |
| 100 | "split_path": [ |
| 101 | ".php", |
| 102 | ".php5" |
| 103 | ] |
| 104 | }, |
| 105 | "upstreams": [ |
| 106 | { |
| 107 | "dial": "localhost:9000" |
| 108 | } |
| 109 | ] |
| 110 | } |
| 111 | ] |
| 112 | } |
| 113 | ] |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | } |