I have installed Nginx and I have a Drupal site installed in a sub folder. I also have a directory in /drupalpath/sites/default/files/books/ that stored some PDF in it. I configure my nginx like this:

location /drupalpath {
    rewrite ^/drupalpath/(.*)$ /drupalpath/index.php?q=$1 last;

and it works nice. But my problem is that the PDFs in /drupalpath/sites/default/files/books/ affected this rule and when I click to download my books it send 404 Error because this rule. My question is that how to fix it?

1 Answer 1

location ~ \.pdf$ {
  try_files $uri =404;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.