简体   繁体   中英

Nginx allow access to files from specific referrers

I have a website where I write about applications and sometimes provide download link using a subdomain, however other people also share the download link on their websites which create load on my server, I want to restrict access to files only to referrer from my websites using Nginx.

ie example.com is my website and download.example.com/apps is where I keep files. any idea on how to allow only visitors from example.com to allow access to the files inside the apps directory. I have only NGNIX installed as the web server on the centos 7 server.

and for those not in allowed list redirect them to the home page of my website...

It sounds like you need the http_referer_module

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM