Kubernetes Ingress NGINX for Laravel via fast-cgi Kubernetes Ingress NGINX for Laravel via fast-cgi kubernetes kubernetes

Kubernetes Ingress NGINX for Laravel via fast-cgi


I think the listening port of your nginx configuration should be 9000.

My guess, what you have is:

  • a container with PHP app served by Nginx at port 9000.
  • a ClusterIP service at service port 80, mapped to you port 9000 container port.
  • then you are trying expose your service to outside world using ingress

So you need the following k8 declarations

  • Deployment/Statefulset - to create your container.
  • Service - to map your service port 80 to container port 9000
  • Ingress - to expose your service to outside work at port 80

here is an example (although I use ambassador ingress.class for minikube but the principle is the same) https://github.com/francisfueconcillo/k8-geektalk/blob/master/wp-deployment.yaml


No, you cannot map a service to port 9000 as port 9000 is in php-fpm fast cgi, which is not a webservice. To make it work, you need to set the script_filename, so that kubernetes understand which script to run through php-fpm.Ref: https://kubernetes.github.io/ingress-nginx/user-guide/fcgi-services/

In case you just need to run only one backend that is what you need.However, if you are trying to map multiple path, one with php-fpm and other with normal http mode, that is not support. Because kubernetes ingress in fastcgi mode will run for all it's path.