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

154
Vistas
Nginx two angular apps

I'd like to add separated angular app under a specific path (the path should be at the end of an URL to be matched) - I want to keep both versions which are current and a new one but the new should only be available under the specified path. I tried using alias + try_files. My config:

server {
  listen 80;
  root /dir/project1
  server_name ...;

  index index.html;

  location ~ /path {
    alias /dir/project2
    try_files $uri $uri/ /index.html;
  }

The thing is that when try_files fires up, it takes the path from the root directive - not from the alias. How to fix it? I can only add I cannot use proxy_pass here and root instead of the alias does not work either as it adds paths etc.

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

0

The alias directive works differently when placed inside a regular expression location, but you should probably be using a prefix location anyway. See this document for details.

Also, the use of alias and try_files together can cause problems (see this long standing bug).

You are rewriting the URI to /index.html which is the wrong application, and should instead be /path/index.html.

Try:

location ^~ /path {
    alias /dir/project2;
    if (!-e $request_filename) {
        rewrite ^ /path/index.html last;
    }
}

See this caution on the use of if.

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