Skip to content

Instantly share code, notes, and snippets.

Last active Mar 22, 2019
What would you like to do?
root ./
fastcgi / php {
env FOO bar
rewrite {
regexp .*
ext /
to /index.php?{query}
log stdout
errors stdout
// You have to uncomment the following line if the ini directive auto_globals_jit is On. Otherwise the HTTP env vars will be missing.
// var_dump($_ENV['ANYTHING'] ?? false);
» http localhost:2015
HTTP/1.1 200 OK
Content-Encoding: gzip
Content-Length: 590
Content-Type: text/html; charset=UTF-8
Date: Fri, 22 Mar 2019 19:21:22 GMT
Server: Caddy
Vary: Accept-Encoding
X-Powered-By: PHP/7.1.25
array(34) {
string(4) "matt"
string(11) "/Users/matt"
string(7) "CGI/1.1"
string(0) ""
string(12) "HTTPie/0.9.9"
string(3) "bar"
string(10) "/index.php"
string(4) "2015"
string(0) ""
string(13) "gzip, deflate"
string(1) "/"
string(10) "keep-alive"
string(0) ""
string(3) "::1"
string(0) ""
string(3) "*/*"
string(14) "localhost:2015"
string(7) ""
string(5) "53670"
string(8) "HTTP/1.1"
string(23) "/Users/matt/code/env-ex"
string(1) "0"
string(10) "/index.php"
string(0) ""
string(3) "::1"
string(33) "/Users/matt/code/env-ex/index.php"
string(3) "GET"
string(0) ""
string(12) "Caddy/0.11.5"
string(4) "http"
string(9) "RESPONDER"
string(10) "/index.php"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment