I am trying to server data from my location block.

 location ~ ^/(archivefiles) {
     root /web/htdocs/archivefiles/;

When a user visits. http://www.example.com/archivefiles/sports/football/1981.pdf the page errors. I have tried the following combinations in the location block with no success.

root /web/htdocs/archivefiles;
root /web/htdocs/archivefiles/$1;
root /web/htdocs/$1;

I have looked at the documentation and it looks as if i am using everything correctly.

  • Why is this a regex? Jul 20, 2021 at 12:42
  • 1
    What are you trying to achieve with that regex? Try a prefix one location /archivefiles { root /web/htdocs; } Jul 20, 2021 at 12:47
  • What are you trying to Solve, for me it looks like the X-And-Y-Problem
    – djdomi
    Jul 20, 2021 at 14:38
  • I am deleting this question. I was editing the incorrect nginx config file. I am now getting a permission issue. Jul 20, 2021 at 17:46
  • update the question and show us the error
    – djdomi
    Jul 20, 2021 at 19:31


You must log in to answer this question.

Browse other questions tagged .