Skip to content

Instantly share code, notes, and snippets.

@matt-allan
Last active March 22, 2019 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matt-allan/77cae02c079fbb856992cc099fc28490 to your computer and use it in GitHub Desktop.
Save matt-allan/77cae02c079fbb856992cc099fc28490 to your computer and use it in GitHub Desktop.
0.0.0.0
root ./
gzip
fastcgi / 127.0.0.1:9000 php {
env FOO bar
}
rewrite {
regexp .*
ext /
to /index.php?{query}
}
log stdout
errors stdout
<?php
// 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);
var_dump(getenv());
var_dump(getenv('FOO'));
» 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) {
["USER"]=>
string(4) "matt"
["HOME"]=>
string(11) "/Users/matt"
["GATEWAY_INTERFACE"]=>
string(7) "CGI/1.1"
["AUTH_TYPE"]=>
string(0) ""
["HTTP_USER_AGENT"]=>
string(12) "HTTPie/0.9.9"
["FOO"]=>
string(3) "bar"
["DOCUMENT_URI"]=>
string(10) "/index.php"
["SERVER_PORT"]=>
string(4) "2015"
["CONTENT_TYPE"]=>
string(0) ""
["HTTP_ACCEPT_ENCODING"]=>
string(13) "gzip, deflate"
["REQUEST_URI"]=>
string(1) "/"
["HTTP_CONNECTION"]=>
string(10) "keep-alive"
["QUERY_STRING"]=>
string(0) ""
["REMOTE_HOST"]=>
string(3) "::1"
["PATH_INFO"]=>
string(0) ""
["HTTP_ACCEPT"]=>
string(3) "*/*"
["HTTP_HOST"]=>
string(14) "localhost:2015"
["SERVER_NAME"]=>
string(7) "0.0.0.0"
["REMOTE_PORT"]=>
string(5) "53670"
["SERVER_PROTOCOL"]=>
string(8) "HTTP/1.1"
["DOCUMENT_ROOT"]=>
string(23) "/Users/matt/code/env-ex"
["CONTENT_LENGTH"]=>
string(1) "0"
["SCRIPT_NAME"]=>
string(10) "/index.php"
["REMOTE_USER"]=>
string(0) ""
["REMOTE_ADDR"]=>
string(3) "::1"
["SCRIPT_FILENAME"]=>
string(33) "/Users/matt/code/env-ex/index.php"
["REQUEST_METHOD"]=>
string(3) "GET"
["REMOTE_IDENT"]=>
string(0) ""
["SERVER_SOFTWARE"]=>
string(12) "Caddy/0.11.5"
["REQUEST_SCHEME"]=>
string(4) "http"
["FCGI_ROLE"]=>
string(9) "RESPONDER"
["PHP_SELF"]=>
string(10) "/index.php"
["REQUEST_TIME_FLOAT"]=>
float(1553282482.55)
["REQUEST_TIME"]=>
int(1553282482)
}
bool(false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment