I switched server from Agate to gmid, becaused I am planning on playing with dynamic content in Geminispace.
The current setup of this capsule consists of a Docker/Portainer/traefik server forwarding all traffic on port 1965 to the gmid server. The gmid is configured to forward some traffic based on a location to a php-fpm container.
Portainer docker environment manager
PHP FastCGI Process Manager (FPM)
Simple sample dynamic php app: Berlin local time display
If you find the information on this page useful, please set a back-link and/or let me know!
gmid config file:
protocols "tlsv1.3" server "*" { cert "/etc/cert/cert.pem" key "/etc/cert/key.pem" root "/var/gemini/public" location "/app/*" { fastcgi tcp php } param SCRIPT_FILENAME = "/php/src/app.php" }
Docker base images:
Stack configuration:
version: '3' services: gmid: image: MY-BAKED-GMID-IMAGE restart: unless-stopped labels: - "traefik.enable=true" - "traefik.tcp.routers.gemini.entrypoints=gemini" - "traefik.tcp.routers.gemini.rule=HostSNI(`*`)" - "traefik.tcp.routers.gemini.service=gemini" - "traefik.tcp.routers.gemini.tls.passthrough=true" - "traefik.tcp.services.gemini.loadbalancer.server.port=1965" networks: - traefik-proxy - internal php: image: MY-BAKED-PHPFPM-IMAGE restart: unless-stopped networks: - internal networks: internal: traefik-proxy: external: true
<?php require_once __DIR__ . '/../vendor/autoload.php'; // Prepare Output for Gemini, make PHP not sending any headers ... header_remove(); header("20 text/gemini"); # header_remove() is not enough! see: # https://stackoverflow.com/questions/18326817/remove-content-type-header-in-apache header('Content-Type: text/html'); header_remove('Content-Type'); $path = $_ENV["GEMINI_URL_PATH"]; $params = $_ENV["QUERY_STRING"];