Skip to content
Advertisement

nginx not serving JS, CSS files for PHP app behind ingress-nginx

Can’t seem to get this working and need help on where I am going wrong.

Have an old PHP app subpathed at /admin. ingress-nginx forwards the traffic for it to an nginx server running in the Pod. I’ve verified I can do the following and it serves the assets correctly:

  • kubectl port-forward <admin-pod> 4000:4000
  • skaffold dev --port-forward
  • docker run -p 4000:4000 <image>

However, when I try to connect to access it through browser via the minikube ip, 192.168.64.5/admin for example, I just get the following:

enter image description here

It displays the HTML, but none of the assets are loading because they aren’t being found and I’m not sure why.

This is the nginx default.conf that serves the PHP application. I’d like to fix it in here, if possible, as opposed to in the ingress.yaml because they tends to mess with my other routes and took me a bit of time to get those working properly.

Here is what I have for those files:

JavaScript
JavaScript
JavaScript
JavaScript
JavaScript

Thanks for the help.

Advertisement

Answer

Managed to get all routes working by moving this path to a separate ingress config. Probably not ideal, but I just need it working until it is replaced in hopefully 6 months.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement