Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

938
Views
Configuración de la aplicación Angular en Nginx Ingress AKS

Implementé una aplicación Angular SPA en Azure Kubernetes. Estaba tratando de acceder a la aplicación a través del controlador Ingress Nginx. Ingress apunta a xxx.xxx.com y la aplicación se implementa en la ruta "/". Entonces, cuando accedí a la aplicación, la aplicación se está cargando bien. Pero cuando trato de navegar a cualquier otra página que no sea index.html al ingresarla directamente en el navegador (por ejemplo: eee.com/homepage), obtengo 404 No encontrado.

El siguiente es el contenido del archivo acoplable

 # base image FROM nginx:1.16.0-alpine # copy artifact build from the 'build environment' COPY ./app/ /usr/share/nginx/html/ RUN rm -f /etc/nginx/conf.d/nginx.config COPY ./nginx.config /etc/nginx/conf.d/nginx.config # expose port 80 EXPOSE 80 # run nginx CMD ["nginx", "-g", "daemon off;"]

Ingress.yaml

 apiVersion: extensions/v1beta1 kind: Ingress metadata: name: app-frontend-ingress namespace: app annotations: kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/use-regex: "true" nginx.ingress.kubernetes.io/add-base-url: "true" nginx.ingress.kubernetes.io/rewrite-target: / spec: tls: - hosts: - xxx.com secretName: tls-dev-app-ingress rules: - host: xxx.com http: paths: - backend: serviceName: poc-service servicePort: 80 path: /

nginx.conf

 server { listen 80; location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puede agregar un fragmento de configuración que se encargará de reescribir cualquier ruta a / :

 apiVersion: extensions/v1beta1 kind: Ingress metadata: name: app-frontend-ingress namespace: app annotations: kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/use-regex: "true" nginx.ingress.kubernetes.io/configuration-snippet: | rewrite /([^.]+)$ / break; [...]

Por ejemplo, si va a host.com/xyz , será redirigido a host.com

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!