英文:
K8s Nginx Ingress controller RewriteRule
问题
需要将Apache配置迁移到K8s Nginx Ingress控制器,我卡在了这一部分:
<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:
    [这里似乎应该定义规则?]
spec:
  rules:
  - host: [some-host.com]
    http:
      paths:
      - path: [?]
      ...
英文:
I need to move Apache config to K8s Nginx ingress controller and I stucked on this part:
<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>
Looks like I can define it in annotation, but I can`t find good example how I can do it.
---
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: [?]
      ...
答案1
得分: 0
需要休息一下,这些规则与目录有关,与交通规则无关,需要重写 :/
K8s Nginx Ingress 不参与此过程。
英文:
Need some rest, these rules related to dir and not related to traffic rules rewrite :/
K8s Nginx ingress does not involved in this process.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论