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

157
Vistas
How can I make nginx redirect subdomain to a folder?

How can I make nginx redirect all the requests to my subdomain to a folder?

Example:

http://sub2.sub1.domain.com/

that should indicate that sub2 is a folder in sub1.domain.com/sub2

How can I do this?

The main objective is to hide the folder to the user. So, it should continue as http://sub2.sub1.domain.com/

My wish is to use a wildcard in sub2.

UPDATE:

I've tried:

server {
    listen 80;
    listen [::]:80;

    server_name ~^(.*)\.sis\..*$;

location / {
    proxy_pass http://sis.mydomain.com/$1$request_uri;
    }
}

but it also didn't work, any error?

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

0

In the nginx directives for sub2.sub1.domain.com you'd put:

server {
    listen 80;
    server_name sub2.sub1.domain.com;

location / {
    proxy_pass https://sub1.domain.com/sub2;
    }
}

So any request going to sub2.sub1.domain.com gets proxied to → sub1.domain.com/sub2 (while masked as sub2.sub1.domain.com); no need for a redirect or rewrite this way either.

Wildcard Method

server {
    listen 80;
    server_name ~^(.*)\.sub1\.domain\.com;

location / {
    proxy_pass https://sub1.domain.com/$1;
    }
}

*the wildcard method above is untested.

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