<p>I have Nginx Ingress service running on 30001
Kubernetes version 1.18.6
Cluster configured with VmWare workstation</p>
<p>I have deployed wordpress and I have a ingress for wordpress</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingress-wordpress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/ssl-redirect: &quot;false&quot;
spec:
 rules:
   - http:
       paths:
          - path: /wordpress(/|$)(.*)
            backend:
              serviceName: wordpress
              servicePort: 80
</code></pre>
<p>This is my wordpress deployment</p>
<pre><code>    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: wordpress
      labels:
        name: wordpress
    
    spec:
      template:
        # Pod definition
        metadata:
          name: wordpress
          labels:
            name: wordpress
        spec:
          containers:
            - name: wordpress
              image: wordpress
              volumeMounts:
                - mountPath: /var/www/html
                  name: wordpress-persistent-storage
              env:
              - name: WORDPRESS_DB_PASSWORD
                valueFrom:
                    secretKeyRef:
                      name: mysql-pass
                      key: password
              - name: WORDPRESS_DB_HOST
                value: &quot;wordpress-mysql&quot;
              - name: WORDPRESS_DB_USER
                value: &quot;root&quot;
          volumes:
        - name: wordpress-persistent-storage
          persistentVolumeClaim:
            claimName: wordpress-persistent-storage
  replicas: 2
  selector:
    matchLabels:
      name: wordpress
</code></pre>
<p>This is my nginx ingress controller</p>
<pre><code>apiVersion: apps/v1

kind: Deployment

metadata:

  name: nginx-ingress-controller

spec:

  replicas: 1

  selector:

    matchLabels:

      name: nginx-ingress

  template:

    metadata:

      labels:

        name: nginx-ingress

    spec:

      containers:

        - name: nginx-ingress-controller

          image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.31.1

          args:

            - /nginx-ingress-controller

            - --configmap=$(POD_NAMESPACE)/nginx-configuration

          env:

            - name: POD_NAME

              valueFrom:

                fieldRef:

                  fieldPath: metadata.name

            - name: POD_NAMESPACE

              valueFrom:

                fieldRef:

                  fieldPath: metadata.namespace

          ports:

            - name: http

              containerPort: 80

            - name: https

              containerPort: 443
</code></pre>
<p>my worker IPs are 192.168.111.136,192.168.111.137</p>
<p>when I load http://worker-ip:30001/wordress</p>
<p>I am getting redirected for http://worker-ip:30001/wp-admin/install.php
which is the correct url of course.</p>
<p>But my browser shows 404 Not Found</p>
<p><a href="https://i.stack.imgur.com/oC4g5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oC4g5.png" alt="enter image description here" /></a></p>
<p>This is my logs for --&gt; kubectl logs nginx-ingress-controller-776d4c78f9-fkrgx -f</p>
<pre><code>I1014 16:34:37.481750       6 event.go:278] Event(v1.ObjectReference{Kind:&quot;Ingress&quot;, Namespace:&quot;default&quot;, Name:&quot;ingress-wordpress&quot;, UID:&quot;6051b54a-c359-469b-a34e-8ba1b0202ebd&quot;, APIVersion:&quot;networking.k8s.io/v1beta1&quot;, ResourceVersion:&quot;171471&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'DELETE' Ingress default/ingress-wordpress
I1014 16:34:37.535710       6 controller.go:155] Backend successfully reloaded.
I1014 16:34:40.458184       6 event.go:278] Event(v1.ObjectReference{Kind:&quot;Ingress&quot;, Namespace:&quot;default&quot;, Name:&quot;ingress-wordpress&quot;, UID:&quot;0c6d67d5-a118-4391-b3ca-c8179fd12a44&quot;, APIVersion:&quot;networking.k8s.io/v1beta1&quot;, ResourceVersion:&quot;171482&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'CREATE' Ingress default/ingress-wordpress
I1014 16:34:40.815250       6 controller.go:139] Configuration changes detected, backend reload required.
I1014 16:34:40.865628       6 controller.go:155] Backend successfully reloaded.
10.32.0.1 - - [14/Oct/2020:16:34:52 +0000] &quot;GET /wordpress HTTP/1.1&quot; 302 0 &quot;-&quot; &quot;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36&quot; 458 0.012 [default-wordpress-80] [] 10.32.0.4:80 0 0.012 302 3fa7b1be573bb3db1e573953d7c29aba
I1014 16:35:05.344074       6 status.go:275] updating Ingress default/ingress-wordpress status from [] to [{192.168.111.136 }]
I1014 16:35:05.349635       6 event.go:278] Event(v1.ObjectReference{Kind:&quot;Ingress&quot;, Namespace:&quot;default&quot;, Name:&quot;ingress-wordpress&quot;, UID:&quot;0c6d67d5-a118-4391-b3ca-c8179fd12a44&quot;, APIVersion:&quot;networking.k8s.io/v1beta1&quot;, ResourceVersion:&quot;171546&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'UPDATE' Ingress default/ingress-wordpress
10.44.0.0 - - [14/Oct/2020:16:44:14 +0000] &quot;GET /wordpress HTTP/1.1&quot; 302 0 &quot;-&quot; &quot;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36&quot; 439 0.009 [default-wordpress-80] [] 10.32.0.4:80 0 0.012 302 54c29a839541ce6e724ce004a0890942
10.32.0.1 - - [14/Oct/2020:16:45:35 +0000] &quot;GET /wordpress HTTP/1.1&quot; 302 0 &quot;-&quot; &quot;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36&quot; 458 0.012 [default-wordpress-80] [] 10.32.0.4:80 0 0.012 302 83335c2e98f6784efd051d81b84ad2ef
10.32.0.1 - - [14/Oct/2020:16:45:37 +0000] &quot;GET /wordpress/ HTTP/1.1&quot; 302 0 &quot;-&quot; &quot;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36&quot; 440 0.021 [default-wordpress-80] [] 10.44.0.3:80 0 0.020 302 db916b199d7f08379ac79122415855b7
</code></pre>
<p>How to correct this ?</p>

<p>Your application is redirecting you to <code>/wp-admin/</code>. This path does not match any Ingress rules, so it returns 404.</p>
<p>You need to add a <code>wp-admin</code> HTTP path rule as well, so the request will be properly proxy-forwarded to the WordPress container.</p>
