<p>I want to edit my <code>Nginx.conf</code> file present inside Nginx controller pod in AKS, but the edit command is not working using the exec command, is there any way else I could edit my <code>nginx.conf</code>.</p>
<p>the command which I tried:</p>
<pre><code>kubectl exec -it nginx-nginx-ingress-controller -n nginx --  cat /etc/nginx/nginx.conf
</code></pre>

<p>As mentioned by CrowDev, it's not good practice to update the config of Nginx controller like that.</p>
<p>Nginx controller is the backend of the <strong>ingress</strong> you can use the <strong>config map</strong> to update the configuration of the Nginx controller and redeploy the pod of the controller.</p>
<p>Some of the <strong>Nginx controller</strong> config could be also overwritten using the ingress config and annotation inside it.</p>
<p>You can read more about annotation here : <a href="https://docs.nginx.com/nginx-ingress-controller/configuration/ingress-resources/advanced-configuration-with-annotations/" rel="nofollow noreferrer">https://docs.nginx.com/nginx-ingress-controller/configuration/ingress-resources/advanced-configuration-with-annotations/</a></p>
<p><strong>Update</strong> :</p>
<p>You can separate out different ingress by their <strong>name</strong>. if you want to manage different configs or headers you need to separate out ingress for managing different configs.</p>
<p>Example :</p>
<p><strong>ingress : 1</strong></p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-one
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/proxy-read-timeout: &quot;3600&quot;
spec:
  rules:
  - http:
      paths:
      - path: /one
        pathType: Prefix
        backend:
          service:
            name: one
            port:
              number: 80
</code></pre>
<p><strong>ingress : 2</strong></p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-two
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /two
        pathType: Prefix
        backend:
          service:
            name: two
            port:
              number: 80
</code></pre>
<p>now <code>nginx.ingress.kubernetes.io/proxy-read-timeout: &quot;3600&quot;</code> will get apply to only one ingress or service.</p>
