kubernetes K8s Nginx Ingress控制器RewriteRule

hwamh0ep  于 2023-04-11  发布在  Kubernetes
关注(0)|答案(1)|浏览(184)

我需要将Apache配置移动到K8s Nginx入口控制器,我在这部分卡住了:

<Directory /var/www/html/motos>
  RewriteRule ^/?.+Portal/index.php(.*)$ /motos/auto_portal/index.php$1
  RewriteRule ^/?.+Portal/private/?(.*)$ /motos/auto_portal/private/$1
  RewriteRule ^/?.+Portal/scripts/?(.*)$ /motos/auto_portal/scripts/$1
  RewriteRule ^/?.+Portal/graphics/?(.*)$ /motos/auto_portal/graphics/$1
</Directory>

看起来我可以在注解中定义它,但我找不到很好的例子来说明如何做到这一点。

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: motos-site
  annotations:
    [looks like here should be defined rules?]
spec:
  rules:
  - host: [some-host.com]
    http:
      paths:
      - path: [?]
      ...
jutyujz0

jutyujz01#

需要休息一下,这些规则与dir相关,与流量规则无关,重写:/ K8s Nginx ingress不参与此过程。

相关问题