apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-config
  labels:
    tier: backend
data:
  config : |
    server {
    listen 80;

    server_name _;
    root /var/www/public; # Must same with PHP-FPM

    error_page 404 /index.php;

    location / {
        fastcgi_pass php.default.svc.cluster.local:9000;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
        fastcgi_param HTTPS off;
    }

    location ~ ^/.+\.php(/|$) {
        fastcgi_pass php.default.svc.cluster.local:9000;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTPS off;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
    }