title: nginx ingress FCGI + wordpress:fpm-alpine. 302 redirect infinite loop
body: <p>So FGCI came out this year. Would like to test out some WordPress but I hear it has some rewrite rules that need to be followed. Can't quite get the <code>nginx.ingress.kubernetes.io/rewrite-target</code> or <code>nginx.ingress.kubernetes.io/configuration-snippet</code> correct. Can anyone help me translate this ingress definition so I can work with just nginx-ingress and wordpress fpm? </p>
  
  <pre><code>apiVersion: v1
  kind: ConfigMap
  metadata:
    name: word-cm
  data:
    SCRIPT_FILENAME: "/var/www/html/index.php"
  
  ---
  
  apiVersion: networking.k8s.io/v1beta1
  kind: Ingress
  metadata:
    annotations:
      kubernetes.io/ingress.class: "nginx"
      nginx.ingress.kubernetes.io/backend-protocol: "FCGI"
      nginx.ingress.kubernetes.io/fastcgi-index: "index.php"
      nginx.ingress.kubernetes.io/fastcgi-params-configmap: "word-cm"
      nginx.ingress.kubernetes.io/configuration-snippet: |
          location / {
            $uri $uri/ /index.php?$args;
          } 
    name: word
  spec:
    rules:
    - host: word.press.site
      http:
        paths:
        - backend:
            serviceName: word
            servicePort: fastcgi
  </code></pre>
  
  <p>Currently getting this when trying to base it off of <a href="https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/" rel="nofollow noreferrer">https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/</a> </p>
  
  <pre><code>-------------------------------------------------------------------------------
  W1227 09:49:02.610057       6 queue.go:130] requeuing mcsh/word, err
  -------------------------------------------------------------------------------
  Error: exit status 1
  2019/12/27 09:49:02 [emerg] 807#807: unknown directive "$uri" in /tmp/nginx-cfg091168912:668
  nginx: [emerg] unknown directive "$uri" in /tmp/nginx-cfg091168912:668
  nginx: configuration file /tmp/nginx-cfg091168912 test failed
  
  -------------------------------------------------------------------------------
  </code></pre>
  
  <p>Without it, I get 302s to install page infinitely. </p>