<p>Can't seem to get this working and need help on where I am going wrong.</p>
<p>Have an old PHP app subpathed at <code>/admin</code>. <code>ingress-nginx</code> forwards the traffic for it to an <code>nginx</code> server running in the Pod. I've verified  I can do the following and it serves the assets correctly:</p>
<ul>
<li><code>kubectl port-forward &lt;admin-pod&gt; 4000:4000</code></li>
<li><code>skaffold dev --port-forward</code></li>
<li><code>docker run -p 4000:4000 &lt;image&gt;</code></li>
</ul>
<p>However, when I try to connect to access it through browser via the <code>minikube ip</code>, <code>192.168.64.5/admin</code> for example, I just get the following:</p>
<p><a href="https://i.stack.imgur.com/rQVjI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rQVjI.png" alt="enter image description here" /></a></p>
<p>It displays the HTML, but none of the assets are loading because they aren't being found and I'm not sure why.</p>
<p>This is the <code>nginx</code> <code>default.conf</code> that serves the PHP application. I'd like to fix it in here, if possible, as opposed to in the <code>ingress.yaml</code> because they tends to mess with my other routes and took me a bit of time to get those working properly.</p>
<p>Here is what I have for those files:</p>
<pre><code># default.conf

server {
  listen 4000;
  # rewrite ^([^.]*[^/])$ $1/ permanent;
  root   /usr/share/nginx/html/src;

  include /etc/nginx/default.d/*.conf;

  index app.php index.php index.html index.htm;

  client_max_body_size 500m;

  location / {
    try_files $uri $uri/ /index.php$is_args$args;
  }

  location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    # Mitigate https://httpoxy.org/ vulnerabilities
    fastcgi_param HTTP_PROXY &quot;&quot;;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fastcgi.conf;
  }
}
</code></pre>
<pre><code># ingress.yaml

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: &quot;nginx&quot;
    nginx.ingress.kubernetes.io/proxy-body-size: &quot;0&quot;
    nginx.org/client-max-body-size: &quot;500m&quot;
  name: ingress-service-dev
  namespace: default
spec:
  rules:
    - http:
        paths:
          - path: /adminv2/
            backend:
              serviceName: admin-new-cluster-ip-service-dev
              servicePort: 4001
          - path: /admin/
            backend:
              serviceName: admin-old-cluster-ip-service-dev
              servicePort: 4000  
          - path: /api/
            backend:
              serviceName: api-cluster-ip-service-dev
              servicePort: 5000
          - path: /
            backend:
              serviceName: client-cluster-ip-service-dev
              servicePort: 3000
</code></pre>
<pre><code># Dockerfile

FROM php:7.3-fpm

# PHP_CPPFLAGS are used by the docker-php-ext-* scripts
ENV PHP_CPPFLAGS=&quot;$PHP_CPPFLAGS -std=c++11&quot;

RUN apt-get update \
    &amp;&amp; apt-get install -y nginx \ 
    &amp;&amp; apt-get install -y libpq-dev zlib1g-dev libzip-dev \
    &amp;&amp; docker-php-ext-install pgsql zip mbstring opcache 
RUN { \
        echo 'opcache.memory_consumption=128'; \
        echo 'opcache.interned_strings_buffer=8'; \
        echo 'opcache.max_accelerated_files=4000'; \
        echo 'opcache.revalidate_freq=2'; \
        echo 'opcache.fast_shutdown=1'; \
        echo 'opcache.enable_cli=1'; \
    } &gt; /usr/local/etc/php/conf.d/php-opocache-cfg.ini

COPY . /usr/share/nginx/html
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
COPY ./conf/default.conf /etc/nginx/conf.d/default.conf
COPY ./conf/entrypoint.sh /etc/entrypoint.sh

WORKDIR /usr/share/nginx/html/src

RUN composer install
# COPY --chown=www-data:www-data . /app/src

RUN mv &quot;$PHP_INI_DIR/php.ini-production&quot; &quot;$PHP_INI_DIR/php.ini&quot;
RUN mv &quot;/usr/share/nginx/html/conf/file_size.ini&quot; &quot;$PHP_INI_DIR/conf.d/&quot;

# EXPOSE 4000

ENTRYPOINT [&quot;sh&quot;, &quot;/etc/entrypoint.sh&quot;]
</code></pre>
<pre><code># project structure

app-root/
  admin-new/
  admin-old/
    conf/
      company.conf
    src/
      css/
      js/
      Templates/
        index.tbs
      index.php
    Dockerfile.dev
  api/
  client/
  manifests/
</code></pre>
<pre><code># docker structure

/app
  conf/
    company.conf
  src/
    css/
    js/
    Templates/
      index.tbs
    index.php
  Dockerfile.dev
</code></pre>
<p>Thanks for the help.</p>

<p>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.</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: &quot;nginx&quot;
    nginx.ingress.kubernetes.io/proxy-body-size: &quot;0&quot;
    nginx.org/client-max-body-size: &quot;500m&quot;
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    nginx.ingress.kubernetes.io/configuration-snippet: |
      rewrite ^(/admin)$ $1/ permanent;
  name: ingress-service-dev-admin
  namespace: default
spec:
  rules:
    - http:
        paths:
          - path: /admin/?(.*)
            backend:
              serviceName: admin-old-cluster-ip-service-dev
              servicePort: 4000  
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: &quot;nginx&quot;
    nginx.ingress.kubernetes.io/configuration-snippet: |
      rewrite ^(/new-admin)$ $1/ permanent;
  name: ingress-service-dev
  namespace: default
spec:
  rules:
    - http:
        paths:
          - path: /new-admin/
            backend:
              serviceName: admin-new-cluster-ip-service-dev
              servicePort: 4001
          - path: /api/
            backend:
              serviceName: api-cluster-ip-service-dev
              servicePort: 5000
          - path: /
            backend:
              serviceName: client-cluster-ip-service-dev
              servicePort: 3000
</code></pre>
