How to enable hot linking in nginx?


Hey guys I have to disable hot linking in my server. How can I do this on nginx?


How did You disable hotlinking? Just reverse it :wink:

It isn’t enabled by default on nginx.


Sorry I made a mistake I want to disable it.:relaxed::open_mouth:


Do You host content in a single directory?

You can use

Location somedirectory {
  Deny All;
  Allow from your_host_name;

Warning: Syntax is written from the top of my head and is untested, please do Your due diligence before uploading.


Check server block.

cd /etc/nginx/sites-available/ && vdir
nano my-site


Hey bro I added following code in server block and sever test is also successful but I have two new question.

  1. How can I check is this working?
  2. As you know! we also have a domain. So, do we need to add cdn domain in conf?
location ~ .(gif|png|jpeg|jpg|svg)$ {
     valid_referers none blocked *;
     if ($invalid_referer) {
        return   403;


BunnyCDN has inbuilt features for the same. You can use.


Ok how can check hot linking is working?


Here you go


Hey brow I speed up my website as much as I possible. I also found best tutorial but I am unable to follow those steps.

By the way Please analyse my website speed and give me review about how my website load?

Second thing I have decided to go with BunnyCDN. - ya it is true if our server and cdn is belongs to from same location. This means not much beneficial for speed. But we don’t have an idea from which location google is crawling our website to analyse speed. If we enabled CDN we don’t need to think about google and page speed.

The last thing about that I am thinking a lot…

Bro my images load from will it safe for SEO?

I am asking this question because many blogs that are using cdn their image loads by main domain.

The nearest example is of your blog. You are using BunnyCDN but I haven’t seen with image. I hope you have understood about what was I trying to say.