1

I've been pulling my hair out for hours now.

My [statamic CMS] sites are running in subdirectories on a staging server.

  • domain.com/site1/
  • domain.com/site2/
  • domain.com/site3/

I'm using and NGINX conf provided by Statamic:

https://gist.github.com/jackmcdade/3866603

Which I've modified like so:

https://gist.github.com/LkeMitchll/b6d8aea6c0845e3a341f

All is working but...

...when I navigate to domain.com/site1/_config/users/admin.yaml I can download the file without restriction!(!!)

The NGINX config line in question is:

location ~ /.(yml|yaml|html) { deny all; }

I've tried the following but no luck:

location ~ /(site1|site2|site3)/.+\.(yml|yaml|html) { deny all; }

To be honest I'm a complete n00b at NGINX, and it's proving much more difficult to use than Apache.

So my question is how do I modify the above statement to restrict access to the .yaml and .html files?

Thanks.

LM

1 Answer 1

2

Give this a try. It requires a $ to match end of string.

location ~* (?:\.(?:yml|yaml|html)|~)$ {
    deny all;
}
Sign up to request clarification or add additional context in comments.

1 Comment

EDIT: Working! Sorry, forgot to clear the cache. Thanks!

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.