# Kubernetes + nginx + php-fpm

**URL:** <https://discuss.kubernetes.io/t/kubernetes-nginx-php-fpm/20626>\
**Category:** General Discussions\
**Created:** [July 14, 2022, 12:21pm UTC](https://discuss.kubernetes.io/t/kubernetes-nginx-php-fpm/20626 "2022-07-14T12:21:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![serginirod](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@serginirod](https://discuss.kubernetes.io/u/serginirod)\
**Post date:** [July 14, 2022, 12:21pm UTC](https://discuss.kubernetes.io/t/kubernetes-nginx-php-fpm/20626/1 "2022-07-14T12:21:23Z")

</div>

Asking for help? Comment out what you need so we can get more information to help you!

### Cluster information:

Kubernetes version: 1.24  
Cloud being used: (put bare-metal if not on a public cloud)  
Installation method:  
Host OS: ubuntu 20.04 (Vmware)  
CNI and version:  
CRI and version:

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

hello,  
i am setting up a nginx + php-fpm in different pods and same namespaces. I have the problem of connect refused in the question asking nginx against php-fpm:

[error] 9#9: \*1 connect() failed (111: Connection refused) while connecting to upstream, client: 10.1.1.232, server: cluster.test, request: “GET / HTTP/1.1”, upstream: “fastcgi://XX.XX.XX.XX:9000”, host: “XXXXX”

---

<div class="post-metadata">

**Author:** ![tej-singh-rana](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/tej-singh-rana/32/5921_2.png) [@tej-singh-rana](https://discuss.kubernetes.io/u/tej-singh-rana)\
**Post date:** [July 14, 2022, 2:34pm UTC](https://discuss.kubernetes.io/t/kubernetes-nginx-php-fpm/20626/2 "2022-07-14T14:34:18Z")

</div>

Hi,  
This information is not enough.

---

<div class="post-metadata">

**Author:** ![serginirod](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@serginirod](https://discuss.kubernetes.io/u/serginirod)\
**Post date:** [July 15, 2022, 6:34am UTC](https://discuss.kubernetes.io/t/kubernetes-nginx-php-fpm/20626/3 "2022-07-15T06:34:06Z")

</div>

Hello,  
Please find attached all the information about this problem.

I have a master and a worker, I have deployed a nginx and php-fpm as deployment and service.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/kubernetes/original/2X/a/a3f450a3c584dd4c6c824ac7956f7a9dfabafde0.png)

kubectl get svc -A

NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE  
default kubernetes ClusterIP 10.96.0.1 443/TCP 14d  
isid nginx-ingress NodePort 10.97.46.145 80:32608/TCP 18h  
isid php-fpm ClusterIP 10.96.55.23 9000/TCP 18h  
kube-system kube-dns ClusterIP 10.96.0.10 53/UDP,53/TCP,9153/TCP 14d

And when I do a http://ip\_worker:puerto\_svc it gives the following error:  
2022/07/14 11:54:23 [error] 9#9: \*1 connect() failed (111: Connection refused) while connecting to upstream, client: 10.1.1.232, server: agora.lab, request: “GET / HTTP/1.1”, upstream: “fastcgi://10.96.55.23:9000”, host: “labk8sworker01”  
10.1.1.232 - - [14/Jul/2022:11:54:23 +0000] “GET / HTTP/1.1” 502 150 “-” “curl/7.68.0”

On the other hand, in this case, what would be the best way to deploy nginx + php-fpm, with independent pods or in the same pod both containers?

---

<div class="post-metadata">

**Author:** ![serginirod](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@serginirod](https://discuss.kubernetes.io/u/serginirod)\
**Post date:** [July 18, 2022, 6:25am UTC](https://discuss.kubernetes.io/t/kubernetes-nginx-php-fpm/20626/4 "2022-07-18T06:25:27Z")

</div>

can you think of any idea why it does not connect nginx against php-fpm?
