Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

528
Vistas
Nginx, nuxt.js static generated mode and redirection of trailing slashs

i currently have a problem configuring my Nginx correctly for nuxt.js generated sites. What i want to achieve is the following

/magazin -> /magazin/index.html
/magazin/ -> 301 /magazin

/magazin/artikel/titel-goes-here -> /magazin/artikel/titel-goes-here/index.html
/magazin/artikel/titel-goes-here/ -> 301 /magazin/artikel/titel-goes-here

currently this is the other way around.

If im correct i shouldn't use a proxy pass to a e.g. pm2 instance with express etc. as it destroys the sense of static site generation.

But how can i get this page structure to work, as i need the same url's as our legacy service for SEO reasons, which used Angular Universal SSR

my current config is:

location ^~ /magazin {
   root /path/to/dist;
   index index.html ;
}

if i add something like

rewrite ^(.+)/+$ $1 permanent; 

i get an infinite 301 loop

Thanks for the help

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You cannot use the built in index directive, as it works the other way around (as you have observed).

You can use try_files to test for the existence of the index.html file. Use a named location to process the redirection.

For example:

location ^~ /magazin {
    root /path/to/dist;
    try_files $uri $uri/index.html @rewrite;
}
location @rewrite {
    rewrite ^(.+)/$ $1 permanent;
}

See this document for details.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda