Install yf

A running site in four steps: PHP 8.2+, a database and a web server.

Quick start

  1. Get yf

    Clone it next to your project folder; the checkout carries the installer.

    git clone https://github.com/yfix/yf.git

    In a Composer project: composer require yfix/yf, then set it up by hand.

  2. Run the installer

    Start it in the web root of the new project and open http://127.0.0.1:8000/. It asks for the full path of the yf checkout, the database, the admin login and the site address, and writes the config, the front controllers and the first admin.

    mkdir -p myproject/www && cd myproject/www
    php -S 127.0.0.1:8000 ../../yf/.dev/install/install.php
  3. Point the web server at www/

    nginx or Caddy with PHP-FPM: ready-made configs below. For a quick look php -S 127.0.0.1:8000 -t www from the project folder does.

  4. Open the site

    / is the site, /admin/ the admin panel: sign in with the admin login you chose.

Requirements

PHP

8.2+ and Composer 2

Database

MariaDB / MySQL, PostgreSQL or SQLite

Web server

nginx or Caddy with PHP-FPM

Cache

Redis / Valkey or Memcached, optional

Web server

Every request that is not a file goes to index.php (admin/index.php under /admin/), which reads the path itself. nginx is the reference; Caddy applies the same rules, and Traefik or Envoy run as the edge proxy in front of nginx. Apache is not supported.

What the samples refuse, upload limits, where the files are

Each sample refuses dot files (except /.well-known/), config/, storage/, logs/ and PHP under uploads/ and /.well-known/, in any case; remove a name your site uses as a route. The files, each with a docker-compose.yml (PHP-FPM on a shared unix socket), are in .dev/useful: nginx_conf (the reference: sites/yf_front_controller.conf and snippets/), caddy_conf, traefik_conf, envoy_conf. Apache is not supported: yf ships no .htaccess and the installer writes none (see the upgrade notes).

Uploads: the samples accept request bodies up to 64 MB. nginx sets client_max_body_size 64m (its default is 1 MB) and the PHP-FPM sample upload_max_filesize and post_max_size to 64M (PHP's defaults are 2M and 8M); change them together. Caddy, Traefik and Envoy set no body limit of their own in these samples (Traefik limits only with its buffering middleware, Envoy only with a buffering filter); the Traefik and Envoy samples forward to the nginx config, which applies its 64 MB.

nginxthe reference config, PHP-FPM

/etc/nginx/sites-available/myproject.conf; set the PHP-FPM socket of your PHP version. Regex locations match in order, so the denies come before the PHP handler:

server {
    listen 80;
    server_name example.com;
    root /var/www/myproject/www;
    index index.php;
    # request bodies (uploads) up to 64 MB, nginx's default is 1 MB: PHP's upload_max_filesize and post_max_size must match
    client_max_body_size 64m;

    # dot files and dirs (.git, .env, .htaccess, .dev ...), except /.well-known/ for ACME
    location ~ /\.(?!well-known/) {
        deny all;
    }
    # never served, also when an old layout keeps them under the web root; remove a name your site uses as a route
    location ~* ^/(config|storage|logs)/ {
        deny all;
    }
    # uploads are data and /.well-known/ is for ACME: no PHP runs from there (nginx merges // and decodes %2F first).
    # Not end-anchored on purpose: a.php.jpg and x.phtml-docs/ match too, like Apache's multi-extension handling
    location ~* ^/(uploads|\.well-known)/.*\.(php|phtml|phar|pht) {
        deny all;
    }

    location / {
        try_files $uri /index.php?$query_string;
    }
    location /admin/ {
        try_files $uri /admin/index.php?$query_string;
    }
    location ~ \.php$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    }
}
Caddyautomatic HTTPS

/etc/caddy/Caddyfile. Caddy gets and renews the Let's Encrypt certificate of the site address itself (ports 80 and 443 open); SITE_ADDRESS=:80 serves plain HTTP behind another proxy:

{$SITE_ADDRESS:example.com} {
    root * /var/www/myproject/www
    encode zstd gzip

    # dot files and dirs (.git, .env, .htaccess, .dev ...), except /.well-known/ for ACME
    @dotfiles {
        path_regexp /\.
        not path /.well-known/*
    }
    error @dotfiles 403
    # never served, also when an old layout keeps them under the web root (remove a name your site uses as a route);
    # uploads are data and /.well-known/ is for ACME: no PHP runs from there. Any case, and // (Caddy keeps it in the path).
    # Not end-anchored on purpose: a.php.jpg and x.phtml-docs/ match too, like Apache's multi-extension handling
    @protected path_regexp (?i)^/+(config|storage|logs)/|^/+(uploads|\.well-known)/.*\.(php|phtml|phar|pht)
    error @protected 403

    # error runs before php_fastcgi and file_server (Caddy's directive order)
    @admin path /admin/*
    php_fastcgi @admin unix//run/php/php8.3-fpm.sock {
        try_files {path} /admin/index.php
    }
    @site not path /admin/*
    php_fastcgi @site unix//run/php/php8.3-fpm.sock {
        try_files {path} /index.php
    }
    file_server

    handle_errors 403 {
        respond "Forbidden" 403
    }
}
Traefikedge proxy in front of nginx

Traefik does not speak FastCGI: it is the edge proxy in front of nginx (the config of the nginx tab), which talks to PHP-FPM. The router and the service come from the file provider, so the Traefik container needs no Docker socket. Static configuration, traefik.yml (HTTPS through Let's Encrypt is optional: uncomment websecure and the resolver):

entryPoints:
  web:
    address: ":80"
    http:
      # X_Forwarded_Proto would reach PHP as HTTP_X_FORWARDED_PROTO, past the header Traefik sets
      aliasHeadersStrategy: delete
      # With HTTPS (the websecure entry point and the letsencrypt resolver below), send plain HTTP there:
      # redirections:
      #   entryPoint:
      #     to: websecure
      #     scheme: https
  # websecure:
  #   address: ":443"
  #   http:
  #     aliasHeadersStrategy: delete
  # internal: /ping for the container health check, not published
  traefik:
    address: ":8080"
    http:
      aliasHeadersStrategy: delete

providers:
  file:
    filename: /etc/traefik/dynamic.yml

ping: {}

# Optional: Let's Encrypt. Publish 80 and 443, keep /letsencrypt on a volume, and move the router to websecure (dynamic.yml).
# certificatesResolvers:
#   letsencrypt:
#     acme:
#       email: [email protected]
#       storage: /letsencrypt/acme.json
#       httpChallenge:
#         entryPoint: web

log:
  level: WARN

Dynamic configuration, dynamic.yml: the router, the nginx service with its health check, and the middlewares:

http:
  routers:
    yf:
      rule: Host(`example.com`)
      entryPoints: [web]
      middlewares: [yf-headers, yf-compress]
      service: yf
      # HTTPS: entryPoints: [websecure] and
      # tls:
      #   certResolver: letsencrypt

  services:
    yf:
      loadBalancer:
        servers:
          - url: http://nginx:80
        healthCheck:
          path: /
          interval: 10s

  middlewares:
    yf-headers:
      headers:
        # an empty value removes the request header
        customRequestHeaders:
          Front-End-Https: ""
          X-Url-Scheme: ""
          Scheme: ""
        contentTypeNosniff: true
        referrerPolicy: strict-origin-when-cross-origin
        # with HTTPS only:
        # stsSeconds: 31536000
    yf-compress:
      compress: {}
Behind a proxy: trusted proxies and scheme headers

Behind a proxy PHP sees nginx's peer address: set $CONF['TRUSTED_PROXIES'] to the proxy network (for example ['172.16.0.0/12'] with Docker) so that the client address is read from X-Forwarded-For only when the proxy sent it. The proxy sets X-Forwarded-Proto from the client connection, which yf reads for HTTPS, and drops the other scheme headers yf would trust (Front-End-Https, X-Url-Scheme, Scheme).

Envoyedge proxy in front of nginx

Envoy as the edge proxy in front of nginx (the config of the nginx tab). It refuses the protected paths itself, normalises the path first (normalize_path, merge_slashes, %2F) and health-checks the upstream. The routes of the listener in envoy.yaml (request_headers_to_remove: [front-end-https, x-url-scheme, scheme] sits next to them):

routes:
  # never served (remove a name your site uses as a route); uploads are data and /.well-known/ is
  # for ACME: no PHP runs from there. Before the /.well-known/ exception, any case. Not end-anchored on
  # purpose: a.php.jpg and x.phtml-docs/ match too, like Apache's multi-extension handling
  - match: { safe_regex: { regex: "(?i)/+(config|storage|logs)/.*|/+(uploads|\\.well-known)/.*\\.(php|phtml|phar|pht).*" } }
    direct_response: { status: 403, body: { inline_string: "Forbidden\n" } }
  # ACME and other /.well-known/ files stay reachable
  - match: { prefix: "/.well-known/" }
    route: { cluster: yf_web }
  # dot files and dirs (.git, .env, .htaccess, .dev ...)
  - match: { safe_regex: { regex: ".*/\\..*" } }
    direct_response: { status: 403, body: { inline_string: "Forbidden\n" } }
  - match: { prefix: "/" }
    route: { cluster: yf_web, timeout: 60s }

The upstream cluster with its health check:

clusters:
  - name: yf_web
    type: STRICT_DNS
    connect_timeout: 5s
    load_assignment:
      cluster_name: yf_web
      endpoints:
        - lb_endpoints:
            - endpoint:
                address:
                  socket_address: { address: nginx, port_value: 80 }
    # the upstream leaves the pool when its home page stops answering 2xx / 3xx
    health_checks:
      - timeout: 5s
        interval: 10s
        unhealthy_threshold: 3
        healthy_threshold: 1
        http_health_check:
          path: /
          expected_statuses: [{ start: 200, end: 400 }]
Behind a proxy: trusted proxies, scheme headers, HTTPS

Behind a proxy PHP sees nginx's peer address: set $CONF['TRUSTED_PROXIES'] to the proxy network (for example ['172.16.0.0/12'] with Docker) so that the client address is read from X-Forwarded-For only when the proxy sent it. The proxy sets X-Forwarded-Proto from the client connection, which yf reads for HTTPS, and drops the other scheme headers yf would trust (Front-End-Https, X-Url-Scheme, Scheme).

For HTTPS add a transport_socket with your certificate to the listener: Envoy does not run ACME.

Docker and Kubernetes

Dockerdevelopment stack: PHP, MariaDB, Redis, Memcached

docker-compose.yml in the yf checkout runs PHP 8.3, MariaDB 10.11, Redis 7 and Memcached 1.6; profiles add Valkey 9 (make test-valkey) and the search backends. It is for development and tests, not production.

docker compose up -d                                   # mariadb, redis, memcached
docker compose run --rm -e YF_DB_NAME=yf_for_unit_tests php php .dev/sample_app/db_init.php
docker compose up php-serve                            # http://127.0.0.1:33380/docs
docker compose run --rm php make test
KubernetesPHP-FPM and nginx in one pod, Ingress

One pod runs PHP-FPM and nginx: PHP-FPM runs your project image (the code plus composer install of yfix/yf), nginx runs the config of the nginx tab from a ConfigMap and talks to PHP-FPM over a unix socket on a shared volume. Both run as non-root on read-only root filesystems under the restricted Pod Security level; PHP writes only to www/uploads/ (a volume claim), storage/, logs/ and /tmp. A Service, an Ingress (TLS optional) and a MariaDB StatefulSet to try it out complete it. The files are in .dev/useful/k8s (plain YAML and a kustomization.yaml); copy them and .dev/useful/php_fpm into your project (deploy/ below), set the image and the host name, and replace the change-me database password in config.yaml before the first apply (MariaDB reads it only when it initialises its volume: changing the Secret later does not change the password), then:

docker build -t yf-php-fpm:8.3 deploy/php_fpm
docker build -f deploy/k8s/Dockerfile -t registry.example.com/myproject:1.0.0 .
docker push registry.example.com/myproject:1.0.0
kubectl apply -k deploy/k8s
kubectl -n yf rollout status deployment/yf
kubectl -n yf port-forward svc/yf 8080:80   # http://127.0.0.1:8080 before DNS points at the Ingress
Configuration, scaling, rollouts, network policy, proxies
  • config/db_setup.php reads the database from the environment (ConfigMap yf-env, Secret yf-db), for example define('DB_HOST', getenv('YF_DB_HOST') ?: 'localhost');
  • The image has no git and its tree is read-only: require the libraries yf would clone at run time with composer, such as greenlion/php-sql-parser:~4.1.2, which yf needs to create missing system tables, and set $PROJECT_CONF['services']['ALLOW_GIT_CLONE'] = false.
  • One replica: uploads is a ReadWriteOnce volume. More replicas need ReadWriteMany (or object) storage for uploads and shared sessions (Redis or the database).
  • Each rollout restarts the pod (Recreate), so the site is down for a moment; sessions live in the pod's /tmp and are lost with it; the readiness probe loads / through PHP and the database, so a database outage takes the site out of the Service.
  • A NetworkPolicy lets only the yf pods reach MariaDB, where the cluster's network plugin enforces policies.
  • Behind the Ingress set $CONF['TRUSTED_PROXIES'] to the pod network. Use a managed database in production; the MariaDB of the sample has no backups.
# PHP-FPM and nginx in one pod. php runs the project image (Dockerfile); an init container copies its www/ to the
# volume nginx serves, at the same path, so try_files and $realpath_root see what PHP-FPM runs. nginx passes PHP to
# the unix socket of zz-yf.conf on the shared php-socket volume. Both run as non-root on read-only root filesystems:
# PHP writes only to www/uploads/, storage/, logs/ and /tmp.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: yf
  labels:
    app.kubernetes.io/name: yf
spec:
  # uploads is a ReadWriteOnce volume: one pod at a time. More replicas need ReadWriteMany storage (or object storage)
  # for uploads and shared sessions (Redis or the DB), then RollingUpdate
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/name: yf
  template:
    metadata:
      labels:
        app.kubernetes.io/name: yf
    spec:
      automountServiceAccountToken: false
      securityContext:
        runAsNonRoot: true
        fsGroup: 33
        seccompProfile:
          type: RuntimeDefault
        sysctls:
          # nginx runs as its own user and keeps `listen 80` of the reference config
          - name: net.ipv4.ip_unprivileged_port_start
            value: "80"
      initContainers:
        - name: web-root
          image: registry.example.com/myproject:1.0.0
          command: [cp, -R, /var/www/myproject/www/., /web/]
          securityContext:
            runAsUser: 33
            runAsGroup: 33
            readOnlyRootFilesystem: true
            allowPrivilegeEscalation: false
            capabilities:
              drop: [ALL]
          resources:
            requests: { cpu: 50m, memory: 32Mi }
            limits: { memory: 128Mi }
          volumeMounts:
            - { name: web, mountPath: /web }
      containers:
        - name: php
          image: registry.example.com/myproject:1.0.0
          envFrom:
            - configMapRef:
                name: yf-env
          env:
            - name: YF_DB_PSWD
              valueFrom:
                secretKeyRef: { name: yf-db, key: password }
          securityContext:
            runAsUser: 33
            runAsGroup: 33
            readOnlyRootFilesystem: true
            allowPrivilegeEscalation: false
            capabilities:
              drop: [ALL]
          resources:
            requests: { cpu: 100m, memory: 128Mi }
            limits: { memory: 768Mi }
          # the master accepts on its socket; the pages themselves are the readiness probe of nginx
          livenessProbe:
            exec:
              command: [php, -r, 'exit(@stream_socket_client("unix:///run/php/php8.3-fpm.sock") ? 0 : 1);']
            periodSeconds: 20
            timeoutSeconds: 5
          volumeMounts:
            - { name: php-socket, mountPath: /run/php }
            - { name: uploads, mountPath: /var/www/myproject/www/uploads }
            - { name: storage, mountPath: /var/www/myproject/storage }
            - { name: logs, mountPath: /var/www/myproject/logs }
            - { name: tmp, mountPath: /tmp }
            - { name: php-fpm, mountPath: /usr/local/etc/php-fpm.d/zz-yf-k8s.conf, subPath: zz-yf-k8s.conf }
        - name: nginx
          image: nginx:1.30.6-alpine@sha256:583b7f2fce1cdb8da5ad5c39ebd3c33b98b87d493190e548bdee1fa8c619c311
          ports:
            - { name: http, containerPort: 80 }
          securityContext:
            runAsUser: 101
            runAsGroup: 101
            readOnlyRootFilesystem: true
            allowPrivilegeEscalation: false
            capabilities:
              drop: [ALL]
          resources:
            requests: { cpu: 50m, memory: 32Mi }
            limits: { memory: 128Mi }
          # through PHP and the database: a pod that cannot render pages gets no traffic
          readinessProbe:
            httpGet: { path: /, port: http }
            periodSeconds: 10
            timeoutSeconds: 5
          livenessProbe:
            tcpSocket: { port: http }
            periodSeconds: 20
          volumeMounts:
            - { name: nginx-conf, mountPath: /etc/nginx/conf.d/default.conf, subPath: default.conf }
            - { name: web, mountPath: /var/www/myproject/www, readOnly: true }
            - { name: uploads, mountPath: /var/www/myproject/www/uploads, readOnly: true }
            - { name: nginx-run, mountPath: /run }
            - { name: php-socket, mountPath: /run/php }
            - { name: nginx-cache, mountPath: /var/cache/nginx }
      volumes:
        - { name: web, emptyDir: {} }
        - { name: php-socket, emptyDir: { medium: Memory, sizeLimit: 1Mi } }
        - { name: uploads, persistentVolumeClaim: { claimName: yf-uploads } }
        # cache and logs (storage/logs/, and logs/ for the error log): gone with the pod. A PersistentVolumeClaim like
        # uploads if the site keeps data there
        - { name: storage, emptyDir: { sizeLimit: 1Gi } }
        - { name: logs, emptyDir: { sizeLimit: 256Mi } }
        # sessions and upload temp files of PHP: room for a few 64 MB uploads at once (client_max_body_size, post_max_size)
        - { name: tmp, emptyDir: { sizeLimit: 512Mi } }
        - { name: nginx-run, emptyDir: { medium: Memory, sizeLimit: 1Mi } }
        # nginx buffers request bodies here before it passes them to PHP-FPM
        - { name: nginx-cache, emptyDir: { sizeLimit: 512Mi } }
        - { name: nginx-conf, configMap: { name: yf-nginx } }
        - { name: php-fpm, configMap: { name: yf-php-fpm } }
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: yf-uploads
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 1Gi
# The project image of the Kubernetes sample: the PHP-FPM image of ../php_fpm with the project code and vendor/
# (composer.json requires yfix/yf). Code and vendor/ belong to root, PHP runs as www-data. The image has no git and its
# tree is read-only: libraries yf would clone at run time come through composer.json too, such as
# greenlion/php-sql-parser ~4.1.2, which yf needs to create missing system tables (www/index.php loads
# vendor/autoload.php). From the project directory:
#   docker build -t yf-php-fpm:8.3 /path/to/yf/.dev/useful/php_fpm
#   docker build -f /path/to/yf/.dev/useful/k8s/Dockerfile -t registry.example.com/myproject:1.0.0 .
# Dockerfile.dockerignore next to this file keeps .git, .env, keys, auth.json, vendor/ and the writable dirs out of the
# build. Private composer repositories: pass auth.json as a BuildKit secret (RUN --mount=type=secret, docker build
# --secret), never COPY it. The php_fpm image is PHP 8.3 on /run/php/php8.3-fpm.sock, the path of the nginx config,
# zz-yf.conf and the liveness probe of deployment.yaml: change them together with the PHP version.
ARG PHP_FPM_IMAGE=yf-php-fpm:8.3

FROM composer:2.10.3@sha256:2cf275428757e5435a667bfc0d038b14520ca02be2b1b70d44a05c8c19e2de48 AS vendor
WORKDIR /app
COPY composer.json composer.lock* ./
RUN composer install --no-dev --no-interaction --no-progress --prefer-dist --optimize-autoloader --no-scripts

FROM ${PHP_FPM_IMAGE}
# without a php.ini display_errors is on: errors end up in the page. php.ini-production logs them to stderr instead
RUN cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
WORKDIR /var/www/myproject
COPY . .
COPY --from=vendor /app/vendor vendor/
# the volumes of deployment.yaml are mounted here
RUN mkdir -p www/uploads storage logs && chown www-data:www-data www/uploads storage logs
USER www-data
Kubernetes with the Gateway APIinstead of the Ingress

On a cluster that routes with the Gateway API (Envoy Gateway, NGINX Gateway Fabric, Istio, Cilium, Traefik or a cloud provider's gateway), use the Gateway and HTTPRoute of k8s/gateway/ (a kustomize component) in place of the Ingress: uncomment its two components lines in kustomization.yaml, set gatewayClassName in gateway/gateway.yaml to your class (kubectl get gatewayclass) and the host name in both files, then apply as above. The cluster needs the Gateway API CRDs of the standard channel (v1.x; the sample uses only gateway.networking.k8s.io/v1) and an implementation that serves the class; it is tested with Gateway API v1.6.1 and Envoy Gateway v1.9.3.

Shared Gateway, HTTPS, timeouts, request bodies, encoded slashes, proxies
  • The same pod, Service and nginx rules: the denies (dot files, config/, storage/, logs/, PHP under uploads/) stay in the nginx of the pod, since an HTTPRoute has no deny action and its regular-expression paths depend on the implementation. Both variants refuse the same paths.
  • A shared Gateway, run for the whole cluster in its own namespace: drop gateway.yaml from the component and point parentRefs of httproute.yaml at it (namespace, sectionName); its listener must admit routes from the yf namespace.
  • HTTPS: the certificate Secret goes on an https listener of the Gateway, and plain HTTP needs an explicit RequestRedirect route (commented in httproute.yaml); an Ingress controller redirects on its own once TLS is set.
  • The route sets a 60 s request timeout, the time the nginx of the pod waits for PHP-FPM; Envoy-based gateways answer 504 after 15 s without it.
  • Request bodies: the nginx of the pod and PHP accept 64 MB. An Ingress controller has a limit of its own (1 MB on the nginx controllers, raised with an annotation, see ingress.yaml); Envoy Gateway passes the body on, so the pod's 64 MB applies. Other implementations may have their own.
  • A path with an encoded slash (%2F) gets a redirect to the decoded path from Envoy Gateway, which nginx then refuses or routes as usual.
  • PHP sees the address of the gateway's proxy: set $CONF['TRUSTED_PROXIES'] to the network it runs in (the pod network for Envoy Gateway).
# The route of ingress.yaml: example.com, every path to the yf Service. The denies (dot files, config/, storage/, logs/,
# PHP under uploads/ and /.well-known/) stay in the nginx of the pod, as behind the Ingress: an HTTPRoute has no deny
# action, and its regular expression paths are implementation-specific.
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: yf
spec:
  parentRefs:
    # with HTTPS: sectionName: https, and the redirect below for http
    - name: yf
      sectionName: http
  hostnames: [example.com]
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /
      backendRefs:
        - name: yf
          port: 80
      # Envoy-based gateways answer 504 after 15 s without it; the nginx of the pod waits 60 s for PHP-FPM
      timeouts:
        request: 60s
# HTTPS: plain HTTP gets a redirect (an Ingress controller does that on its own once TLS is set)
# ---
# apiVersion: gateway.networking.k8s.io/v1
# kind: HTTPRoute
# metadata:
#   name: yf-https-redirect
# spec:
#   parentRefs:
#     - name: yf
#       sectionName: http
#   hostnames: [example.com]
#   rules:
#     - filters:
#         - type: RequestRedirect
#           requestRedirect:
#             scheme: https
#             statusCode: 301
# A Gateway of the site's own. Many clusters have a shared one, run in its own namespace: then drop this file from
# kustomization.yaml and point parentRefs of httproute.yaml at it (namespace, sectionName); its listener must admit routes
# from the yf namespace (allowedRoutes). gatewayClassName: the class of your implementation (kubectl get gatewayclass);
# eg is the class of the Envoy Gateway quick start, which the test runs.
# PHP sees the address of the gateway's proxy: set $CONF['TRUSTED_PROXIES'] to the network it runs in (the pod network
# for an in-cluster proxy such as Envoy's) so that the client address is read from X-Forwarded-For only when it sent it.
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: yf
spec:
  gatewayClassName: eg
  listeners:
    - name: http
      protocol: HTTP
      port: 80
      hostname: example.com
    # HTTPS: a kubernetes.io/tls Secret with the certificate in this namespace (cert-manager, or kubectl create secret
    # tls yf-tls ...), then the redirect of httproute.yaml
    # - name: https
    #   protocol: HTTPS
    #   port: 443
    #   hostname: example.com
    #   tls:
    #     certificateRefs:
    #       - name: yf-tls
Run the sample appthis docs site, locally

From a yf git checkout with MariaDB or MySQL running (.dev/sample_app/config/db_setup.php reads YF_DB_HOST, YF_DB_NAME, YF_DB_USER, YF_DB_PSWD):

mysql -uroot -p -e 'CREATE DATABASE yf_for_unit_tests'
make serve-init                     # = php .dev/sample_app/db_init.php; YF_INSTALL_FORCE=1 to run it again
make serve                          # http://127.0.0.1:33380/docs

The sample app keeps its own database (yf_for_unit_tests; make serve SAMPLE_DB_NAME=... to change it): the DB test suites truncate the tests database.

make setup installs the developer tools (phars, git hooks); it does not install a site.

More pages