Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

189
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!