fork/static-web-server
git clone https://git.julia.blue/fork/static-web-server
acd8388
allow-symlink
1[ general ] 2 3#### Address & Root dir 4host = "::" 5port = 4433 6root = "docker/public" 7 8#### Logging 9log-level = "trace" 10 11#### Cache Control headers 12cache-control-headers = true 13 14#### Auto Compression 15compression = true 16 17#### Error pages 18page404 = "./404.html" 19page50x = "./50x.html" 20 21#### HTTP/2 + TLS 22http2 = false 23http2-tls-cert = "tests/tls/local.dev_cert.sec1_ec.pem" 24http2-tls-key = "tests/tls/local.dev_key.sec1_ec.pem" 25https-redirect = false 26https-redirect-host = "localhost" 27https-redirect-from-port = 80 28https-redirect-from-hosts = "localhost, 127.0.0.1" 29 30#### CORS & Security headers 31# security-headers = true 32cors-allow-origins = "" 33 34#### Directory listing 35directory-listing = true 36 37#### Directory listing sorting code 38directory-listing-order = 1 39 40#### Directory listing content format 41directory-listing-format = "html" 42 43#### Basic Authentication 44basic-auth = "" 45 46#### File descriptor binding 47# fd = "" 48 49#### Worker threads 50threads-multiplier = 1 51 52#### Grace period after a graceful shutdown 53grace-period = 0 54 55#### Page fallback for 404s 56page-fallback = "" 57 58#### Log request Remote Address if available 59log-remote-address = false 60 61 62#### Redirect to trailing slash in the requested directory uri 63redirect-trailing-slash = true 64 65#### Check for existing pre-compressed files 66compression-static = false 67 68#### List of index files 69index-files = "index.html, index.htm" 70 71#### Maintenance Mode 72maintenance-mode = false 73# maintenance-mode-status = 503 74# maintenance-mode-file = "maintenance.html" 75 76### Windows Only 77 78#### Run the web server as a Windows Service 79# windows-service = false 80 81 82[ advanced ] 83 84#### HTTP Headers customization 85 86#### a. Oneline version 87[[ advanced . headers ]] 88source = "**/*.{js,css}" 89headers = { Access-Control-Allow-Origin = "*" } 90 91# #### b. Multiline version 92[[ advanced . headers ]] 93source = "/index.html" 94[ advanced . headers . headers ] 95Cache-Control = "public, max-age=36000" 96Content-Security-Policy = "frame-ancestors 'self'" 97Strict-Transport-Security = "max-age=63072000; includeSubDomains; preload" 98 99#### c. Multiline version with explicit key (dotted) 100[[ advanced . headers ]] 101source = "**/*.{jpg,jpeg,png,ico,gif}" 102headers . Strict-Transport-Security = "max-age=63072000; includeSubDomains; preload" 103 104 105### URL Redirects 106[[ advanced . redirects ]] 107host = "127.0.0.1:4433" 108source = "/{*}" 109destination = "https://localhost:4433/$1" 110kind = 301 111 112[[ advanced . redirects ]] 113source = "**/{*}.{jpg,jpeg}" 114destination = "http://localhost/$1.$2" 115kind = 301 116 117[[ advanced . redirects ]] 118source = "/index.html" 119destination = "https://static-web-server.net" 120kind = 302 121 122### URL Rewrites 123 124[[ advanced . rewrites ]] 125source = "/image.ico" 126destination = "/assets/favicon.ico" 127# redirect = 301 128 129[[ advanced . rewrites ]] 130source = "/{picture}.{ico,webp}" 131destination = "/assets/$1.$2" 132# redirect = 301 133 134[[ advanced . rewrites ]] 135source = "**/{*}.{png,gif}" 136destination = "/assets/$1.$2" 137# redirect = 301 138 139[[ advanced . rewrites ]] 140source = "/abc/**/*.{svg,jxl}" 141destination = "/assets/favicon.ico" 142 143[[ advanced . rewrites ]] 144source = "/files/{*}" 145destination = "/$1" 146 147### Name-based virtual hosting 148 149[[ advanced . virtual-hosts ]] 150host = "example.com" 151root = "docker" 152 153[[ advanced . virtual-hosts ]] 154host = "localhost" 155root = "docker/abc" 156 157[ advanced . memory-cache ] 158capacity = 100 159# 30min 160ttl = 1800 161# 5min 162tti = 300 163# 8mb 164max-file-size = 8192