...
1{
2 debug
3 admin off
4 on_demand_tls {
5 ask https://example.com
6 }
7}
8
9(blocking) {
10 @blocked {
11 path *.txt *.md *.mdown /site/*
12 }
13 redir @blocked /
14}
15
16example.com, fake.org, {$ENV_SITE} {
17 root * /srv
18
19 respond /get-env {$ENV_VAR}
20
21 tls off
22
23 route {
24 # Add trailing slash for directory requests
25 @canonicalPath {
26 file {
27 try_files {path}/index.php
28 }
29 not path */
30 }
31 redir @canonicalPath {path}/ 308
32
33 # If the requested file does not exist, try index files
34 @indexFiles {
35 file {
36 try_files {path} {path}/index.php index.php
37 split_path .php
38 }
39 }
40 rewrite @indexFiles {http.matchers.file.relative}
41
42 # Proxy PHP files to the FastCGI responder
43 @phpFiles {
44 path *.php
45 }
46 reverse_proxy @phpFiles unix//var/run/php7.4-fpm.sock {
47 transport fastcgi {
48 split .php
49 }
50 }
51 }
52
53 @encode_exts {
54 path / *.html *.js *.css *.svg
55 }
56
57 header {
58 X-Content-Type-Options nosniff
59 X-XSS-Protection "1; mode=block"
60 X-Robots-Tag none
61 Content-Security-Policy "frame-ancestors 'self'"
62 X-Frame-Options DENY
63 Referrer-Policy same-origin
64 }
65
66 @singleLine not path /matcher
67 respond @singleLine "Awesome."
68
69 import blocking
70
71 file_server
72}
View as plain text