Serving static files from ingress-nginx

I have a web server expresswith static files. Let me call it my express-deployment.

I would like to use mine ingress-nginxto serve static files from mine express-deploymentwithout even having to click on my express server.

This nginxis done using a directive locationwhere you specify locally hosted files. Although I see the option locations-snippetin ingress-nginx configMap, I'm not quite sure how it would be in the files in another container.

Is this possible with help ingress-nginx? If so, how can I do this? Alternatively, is this what requires placing the nginx container along my express server? (It seems strange that for this I will need 2 nginx)

+4
source share
1 answer

Theoretically, you can have PV in RWX mode set for express delivery as well as for logging in and providing custom configuration for nginx inbound packets, but this should be avoided. Ingress Controller has one responsibility - it implements the Ingress rules defined in your cluster. In order to serve static content, you must have a block that does this, which really means ie. running second nginx on your stack. The fact is that you should consider your input controller as part of the infrastructure providing the general functions of the cluster, and serving static files from any place (or container, if they are versioned / built as docker images) is a de facto part of your application.

+4

Source: https://habr.com/ru/post/1690215/


All Articles