Webinoly is just the perfect tool for NGINX experts. Give it a try!
0 votes
46 views
by Rookie
Is there a way to use HTTP auth by using "/" and blocking everything, and only omitting few files.

I have a analytics scrips that i want the whole site to be blocked except the few .js files that external websites use.

I read the documentation and it does not hint towards such a scenario.

1 Answer

0 votes
by Expert
selected by
 
Best answer
Yes, it's possible!

Block the whole site, and then add custom location blocks using the custom Nginx files to allow especific files or folders.
by Rookie
# Location block for specific files
location = /path/to/your/analytics/script.js {
    # Turn off HTTP auth for this file
    auth_basic off;
    # Serve the file
    try_files $uri $uri/ =404;
}

using a custom config file would work i assume for such scenario. Thank you for the answer.
Welcome to the Community site for Webinoly.

Our Optimized LEMP Web Server is a powerful set of commands for doing just about anything you could wish.

With Webinoly you can set up your NGINX web server in just one step.

* * * * * * *

To report a bug, please create a new issue on GitHub or ask a question here with the bug tag.
Webinoly Support Paypal Donations

PayPal · GitHub Sponsors · Bitcoin

It is very important that any visitor to the site read the disclaimer, terms of use and privacy and legal statement before start browsing.

...