Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

188
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda