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

191
Vistas
Serve PDF file by location & query parameter

How can I serve a PDF file at the below address:

127.0.0.1/getMeThatFile/willYou?name=jane

which is stored at a location:

/usr/share/nginx/thatFile.pdf

I tried to follow Serve pdf file by location in nginx, but couldn't get it to work:

server {
        location /getMeThatFile/willYou/ {
                alias /usr/share/nginx/;
                return 302 thatFile.pdf;
        }
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

/getMeThatFile/willYou and /getMeThatFile/willYou/ are different URIs. Your question suggests that the request will use the first, but your solution matches the second.

Use location /getMeThatFile/willYou to match both, or location = /getMeThatFile/willYou to match only the first. See this document for details.

To return a single file, use root and try_files. For example:

location = /getMeThatFile/willYou {
    root /usr/share/nginx/;
    try_files /thatFile.pdf =404;
}

Assuming thatFile.pdf always exists, the =404 is never reached, but is necessary as try_files requires at least two parameters. 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