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

255
Vistas
nginx if specific subdomain endpoint

I'd like to put robots.txt for the subdomain dev. to point to a specific robots.txt static file.

What routing rule do I need?

This is what i'm thinking:

if ($host = "dev.example.com") {
    location ^~ /robots.txt {
       allow all;
       root  /static/disallow/robots.txt;
    }
}

Based on Nginx subdomain configuration I believe I may need to just make separate server blocks and use include's. If not a simple routing rule, is the includes method how this is typically done?

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

0

If you are wanting a specific robots.txt for each subdomain, you can do so with separate server blocks like this, which you allude (and link) to in your question:

server {
    server_name subdomainA.domain.com;
    include /common/config/path;
    location = /robots.txt {
        root /subdomainA/path;
    }
}
server {
    server_name subdomainB.domain.com;
    include /common/config/path;
    location = /robots.txt {
        root /subdomainB/path;
    }
}

Regarding your other approach, have you read If is Evil?

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