Skip to content

Instantly share code, notes, and snippets.

@alcohol
Created April 27, 2022 07:11
Show Gist options
  • Select an option

  • Save alcohol/abe25fb3ddd2e22c6f819fba60c323f7 to your computer and use it in GitHub Desktop.

Select an option

Save alcohol/abe25fb3ddd2e22c6f819fba60c323f7 to your computer and use it in GitHub Desktop.

Revisions

  1. alcohol created this gist Apr 27, 2022.
    121 changes: 121 additions & 0 deletions 2.4.6.output
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,121 @@
    array(60) {
    ["AUTH_TYPE"]=>
    string(0) ""
    ["CONTENT_LENGTH"]=>
    string(1) "0"
    ["CONTENT_TYPE"]=>
    string(0) ""
    ["DOCUMENT_ROOT"]=>
    string(4) "/srv"
    ["DOCUMENT_URI"]=>
    string(10) "/index.php"
    ["FCGI_ROLE"]=>
    string(9) "RESPONDER"
    ["GATEWAY_INTERFACE"]=>
    string(7) "CGI/1.1"
    ["GPG_KEYS"]=>
    string(122) "528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD"
    ["HOME"]=>
    string(14) "/home/www-data"
    ["HOSTNAME"]=>
    string(12) "71fbc8f6cbd4"
    ["HTTP_ACCEPT"]=>
    string(135) "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
    ["HTTP_ACCEPT_ENCODING"]=>
    string(17) "gzip, deflate, br"
    ["HTTP_ACCEPT_LANGUAGE"]=>
    string(23) "en-US,en;q=0.9,nl;q=0.8"
    ["HTTP_CACHE_CONTROL"]=>
    string(9) "max-age=0"
    ["HTTP_HOST"]=>
    string(9) "localhost"
    ["HTTP_SEC_CH_UA"]=>
    string(66) "" Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100""
    ["HTTP_SEC_CH_UA_MOBILE"]=>
    string(2) "?0"
    ["HTTP_SEC_CH_UA_PLATFORM"]=>
    string(7) ""Linux""
    ["HTTP_SEC_FETCH_DEST"]=>
    string(8) "document"
    ["HTTP_SEC_FETCH_MODE"]=>
    string(8) "navigate"
    ["HTTP_SEC_FETCH_SITE"]=>
    string(4) "none"
    ["HTTP_SEC_FETCH_USER"]=>
    string(2) "?1"
    ["HTTP_UPGRADE_INSECURE_REQUESTS"]=>
    string(1) "1"
    ["HTTP_USER_AGENT"]=>
    string(106) "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
    ["HTTP_X_FORWARDED_FOR"]=>
    string(21) "172.20.0.1, 127.0.0.1"
    ["HTTP_X_FORWARDED_PROTO"]=>
    string(5) "https"
    ["PATH"]=>
    string(60) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    ["PATH_INFO"]=>
    string(0) ""
    ["PHPIZE_DEPS"]=>
    string(78) "autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c"
    ["PHP_ASC_URL"]=>
    string(54) "https://www.php.net/distributions/php-8.1.4.tar.xz.asc"
    ["PHP_CFLAGS"]=>
    string(83) "-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
    ["PHP_CPPFLAGS"]=>
    string(83) "-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
    ["PHP_INI_DIR"]=>
    string(18) "/usr/local/etc/php"
    ["PHP_LDFLAGS"]=>
    string(12) "-Wl,-O1 -pie"
    ["PHP_SELF"]=>
    string(10) "/index.php"
    ["PHP_SHA256"]=>
    string(64) "05a8c0ac30008154fb38a305560543fc172ba79fb957084a99b8d3b10d5bdb4b"
    ["PHP_URL"]=>
    string(50) "https://www.php.net/distributions/php-8.1.4.tar.xz"
    ["PHP_VERSION"]=>
    string(5) "8.1.4"
    ["PWD"]=>
    string(4) "/srv"
    ["QUERY_STRING"]=>
    string(0) ""
    ["REMOTE_ADDR"]=>
    string(9) "127.0.0.1"
    ["REMOTE_HOST"]=>
    string(9) "127.0.0.1"
    ["REMOTE_IDENT"]=>
    string(0) ""
    ["REMOTE_PORT"]=>
    string(5) "40560"
    ["REMOTE_USER"]=>
    string(0) ""
    ["REQUEST_METHOD"]=>
    string(3) "GET"
    ["REQUEST_SCHEME"]=>
    string(4) "http"
    ["REQUEST_TIME"]=>
    int(1651042959)
    ["REQUEST_TIME_FLOAT"]=>
    float(1651042959.660463)
    ["REQUEST_URI"]=>
    string(1) "/"
    ["SCRIPT_FILENAME"]=>
    string(14) "/srv/index.php"
    ["SCRIPT_NAME"]=>
    string(10) "/index.php"
    ["SERVER_NAME"]=>
    string(9) "localhost"
    ["SERVER_PROTOCOL"]=>
    string(8) "HTTP/1.1"
    ["SERVER_SOFTWARE"]=>
    string(12) "Caddy/v2.4.6"
    ["SHLVL"]=>
    string(1) "1"
    ["USER"]=>
    string(8) "www-data"
    ["argc"]=>
    int(0)
    ["argv"]=>
    array(0) {
    }
    }
    125 changes: 125 additions & 0 deletions 2.5.0.output
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,125 @@
    array(62) {
    ["AUTH_TYPE"]=>
    string(0) ""
    ["CONTENT_LENGTH"]=>
    string(1) "0"
    ["CONTENT_TYPE"]=>
    string(0) ""
    ["DOCUMENT_ROOT"]=>
    string(4) "/srv"
    ["DOCUMENT_URI"]=>
    string(10) "/index.php"
    ["FCGI_ROLE"]=>
    string(9) "RESPONDER"
    ["GATEWAY_INTERFACE"]=>
    string(7) "CGI/1.1"
    ["GPG_KEYS"]=>
    string(122) "528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD"
    ["HOME"]=>
    string(14) "/home/www-data"
    ["HOSTNAME"]=>
    string(12) "71fbc8f6cbd4"
    ["HTTP_ACCEPT"]=>
    string(135) "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
    ["HTTP_ACCEPT_ENCODING"]=>
    string(17) "gzip, deflate, br"
    ["HTTP_ACCEPT_LANGUAGE"]=>
    string(23) "en-US,en;q=0.9,nl;q=0.8"
    ["HTTP_CACHE_CONTROL"]=>
    string(9) "max-age=0"
    ["HTTP_HOST"]=>
    string(9) "localhost"
    ["HTTP_SEC_CH_UA"]=>
    string(66) "" Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100""
    ["HTTP_SEC_CH_UA_MOBILE"]=>
    string(2) "?0"
    ["HTTP_SEC_CH_UA_PLATFORM"]=>
    string(7) ""Linux""
    ["HTTP_SEC_FETCH_DEST"]=>
    string(8) "document"
    ["HTTP_SEC_FETCH_MODE"]=>
    string(8) "navigate"
    ["HTTP_SEC_FETCH_SITE"]=>
    string(4) "none"
    ["HTTP_SEC_FETCH_USER"]=>
    string(2) "?1"
    ["HTTP_UPGRADE_INSECURE_REQUESTS"]=>
    string(1) "1"
    ["HTTP_USER_AGENT"]=>
    string(106) "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
    ["HTTP_X_FORWARDED_FOR"]=>
    string(9) "127.0.0.1"
    ["HTTP_X_FORWARDED_HOST"]=>
    string(9) "localhost"
    ["HTTP_X_FORWARDED_PROTO"]=>
    string(4) "http"
    ["PATH"]=>
    string(60) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    ["PATH_INFO"]=>
    string(0) ""
    ["PHPIZE_DEPS"]=>
    string(78) "autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c"
    ["PHP_ASC_URL"]=>
    string(54) "https://www.php.net/distributions/php-8.1.4.tar.xz.asc"
    ["PHP_CFLAGS"]=>
    string(83) "-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
    ["PHP_CPPFLAGS"]=>
    string(83) "-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
    ["PHP_INI_DIR"]=>
    string(18) "/usr/local/etc/php"
    ["PHP_LDFLAGS"]=>
    string(12) "-Wl,-O1 -pie"
    ["PHP_SELF"]=>
    string(10) "/index.php"
    ["PHP_SHA256"]=>
    string(64) "05a8c0ac30008154fb38a305560543fc172ba79fb957084a99b8d3b10d5bdb4b"
    ["PHP_URL"]=>
    string(50) "https://www.php.net/distributions/php-8.1.4.tar.xz"
    ["PHP_VERSION"]=>
    string(5) "8.1.4"
    ["PWD"]=>
    string(4) "/srv"
    ["QUERY_STRING"]=>
    string(0) ""
    ["REMOTE_ADDR"]=>
    string(9) "127.0.0.1"
    ["REMOTE_HOST"]=>
    string(9) "127.0.0.1"
    ["REMOTE_IDENT"]=>
    string(0) ""
    ["REMOTE_PORT"]=>
    string(5) "40558"
    ["REMOTE_USER"]=>
    string(0) ""
    ["REQUEST_METHOD"]=>
    string(3) "GET"
    ["REQUEST_SCHEME"]=>
    string(4) "http"
    ["REQUEST_TIME"]=>
    int(1651042921)
    ["REQUEST_TIME_FLOAT"]=>
    float(1651042921.470156)
    ["REQUEST_URI"]=>
    string(1) "/"
    ["SCRIPT_FILENAME"]=>
    string(14) "/srv/index.php"
    ["SCRIPT_NAME"]=>
    string(10) "/index.php"
    ["SERVER_NAME"]=>
    string(9) "localhost"
    ["SERVER_PORT"]=>
    string(2) "80"
    ["SERVER_PROTOCOL"]=>
    string(8) "HTTP/1.1"
    ["SERVER_SOFTWARE"]=>
    string(12) "Caddy/v2.5.0"
    ["SHLVL"]=>
    string(1) "1"
    ["USER"]=>
    string(8) "www-data"
    ["argc"]=>
    int(0)
    ["argv"]=>
    array(0) {
    }
    }
    20 changes: 20 additions & 0 deletions Caddyfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    localhost {
    root * /srv
    tls internal
    handle {
    reverse_proxy {
    to localhost:8080
    transport http {
    dial_timeout 2s
    keepalive 60s
    }
    }
    }
    }

    :8080 {
    bind localhost
    php_fastcgi fpm:9000 {
    try_files /index.php{path}
    }
    }
    20 changes: 20 additions & 0 deletions docker-compose.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    version: '3.9'

    services:

    caddy:
    image: caddy:2.4.6 # change to 2.5.0 for comparison
    volumes:
    - .:/srv
    - ./Caddyfile:/etc/caddy/Caddyfile
    ports:
    - 80:80
    - 443:443
    depends_on:
    - fpm

    fpm:
    image: php:8.1-fpm-alpine
    working_dir: /srv
    volumes:
    - .:/srv
    5 changes: 5 additions & 0 deletions index.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    <?php

    header('Content-Type: text/plain');
    ksort($_SERVER);
    var_dump($_SERVER);