{"id":1530,"date":"2020-09-01T05:59:30","date_gmt":"2020-09-01T05:59:30","guid":{"rendered":"http:\/\/ubiq.co\/tech-blog\/?p=1530"},"modified":"2025-08-21T05:32:42","modified_gmt":"2025-08-21T05:32:42","slug":"prevent-image-hotlinking-nginx","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/","title":{"rendered":"How to Prevent Image Hotlinking in NGINX"},"content":{"rendered":"<p>Image hotlinking is when another website links to images on your website images without hosting those images on their own server. It slows down your website and increases your data bandwidth. It is also content piracy since it allows others to serve your content as theirs. So it is important to disable image hotlinking on your website. Here&#8217;s how to prevent image hotlinking in NGINX.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#What_is_Image_Hotlinking\" >What is Image Hotlinking<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#Why_Prevent_Image_Hotlinking\" >Why Prevent Image Hotlinking<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#How_to_Prevent_Image_Hotlinking_in_NGINX\" >How to Prevent Image Hotlinking in NGINX<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#1_Open_NGINX_Configuration_File\" >1. Open NGINX Configuration File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#2_Disable_Image_Hotlinking_in_NGINX\" >2. Disable Image Hotlinking in NGINX<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#3_Restart_NGINX_Server\" >3. Restart NGINX Server<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#4_Verify_Changes\" >4. Verify Changes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"What_is_Image_Hotlinking\"><\/span>What is Image Hotlinking<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Typically, websites link to images hosted on their own servers. This is costly since site owners have to pay for the storage as well network bandwidth used to download images from your site. So some websites link to images hosted on other websites such as yours, on their web pages. They don&#8217;t even bother to download the image and host it on their own servers.<\/p>\n<p>Now when someone loads such a web page, then all images on that are loaded from your server, instead of theirs. So you have to pay for the network bandwidth used to download those images, not to mention its storage costs also. These days image hotlinking is done even by bots that simply crawl your site, note down the image URLs and deliver it to another site owner.\u00a0If the other website turns out to be a high traffic one such as social media site or forum then it will be a huge problem for you.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Why_Prevent_Image_Hotlinking\"><\/span>Why Prevent Image Hotlinking<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Image hotlinking results in unnecessary requests to images on your site. Every time a visitor loads a web page hotlinking to your site&#8217;s images, your server has to process the request. This increases your server load, reduces website performance and increases your data bandwidth costs. That is why it is essential to block hotlinking of images on your website.<\/p>\n<p>In fact, not just images, the same method can be used to link to other files such as PDFs, spreadsheets, etc. on your website. So you have to very alert about it. Doing this is just one of the many steps to <a href=\"https:\/\/ubiq.co\/tech-blog\/harden-nginx-server\/\">harden NGINX server<\/a>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_Prevent_Image_Hotlinking_in_NGINX\"><\/span>How to Prevent Image Hotlinking in NGINX<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Here are the steps to prevent image hotlinking in NGINX.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"1_Open_NGINX_Configuration_File\"><\/span>1. Open NGINX Configuration File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Open terminal and run the following command to open NGINX server configuration file.<\/p>\n<pre>$ sudo vi \/etc\/nginx\/nginx.conf\n<\/pre>\n<p>If you have configured separate virtual hosts for your website (e.g www.website.com), such as \/etc\/nginx\/sites-enabled\/website.conf then open its configuration with the following command<\/p>\n<pre>$ sudo vi\u00a0\/etc\/nginx\/sites-enabled\/website.conf<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"2_Disable_Image_Hotlinking_in_NGINX\"><\/span>2. Disable Image Hotlinking in NGINX<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Add the following <em>location<\/em> block inside <em>server<\/em> block to prevent image hotlinking in NGINX from all domains except your domain (e.g website.com)<\/p>\n<pre>location ~ .(gif|png|jpe?g)$ {\n   valid_referers none blocked website.com *.website.com;\n   if ($invalid_referer) {\n      return 403;\n   }\n}\n<\/pre>\n<p>Let us look at the above code line by line. The first line will match various image file extensions. If you want to add any other extension, you can add a new pipe &#8220;|&#8221; along with the new extension.<\/p>\n<p>In the next line, <em>valid_referers<\/em> lists all the domains that are allowed to link to your website images. Mention your website (e.g. website.com) in it. You can also add any other domains such as trusted search engines Google, Bing, etc. that you want to give access to. You can also include IP addresses here.<\/p>\n<p>If the request is from a domain\/IP that is not mentioned in <em>valid_referers<\/em> NGINX will include it in <em>invalid_referer<\/em> and return &#8220;403: Access Forbidden&#8221; response.<\/p>\n<p>Bonus Read : <a href=\"http:\/\/ubiq.co\/tech-blog\/setup-nginx-virtual-hosts-centos\/\">How to Setup NGINX Virtual Hosts on CentOS<\/a><\/p>\n<p>If you want to prevent hotlinking for files in a specific directory such as <em>\/uploads\/<\/em> then add the following lines in your NGINX configuration file.<\/p>\n<pre>location \/uploads\/ {\n   valid_referers none blocked mywebsite.com *.mywebsite.com;\n   if ($invalid_referer) {\n      return 403;\n   }\n}\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"3_Restart_NGINX_Server\"><\/span>3. Restart NGINX Server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Finally, run the following command to check syntax of your updated config file.<\/p>\n<pre>$ sudo nginx -t\n<\/pre>\n<p>If there are no errors, run the following command to restart NGINX server.<\/p>\n<pre>$ sudo service nginx reload #debian\/ubuntu\n$ systemctl restart nginx #redhat\/centos\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"4_Verify_Changes\"><\/span>4. Verify Changes<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You can verify the changes by running the following cURL command that simulates image hotlinking request from a referrer example.com that is not allowed in our NGINX configuration, to our site&#8217;s image\u00a0 www.website.com\/image.jpg.<\/p>\n<pre>curl -H \"Referer: https:\/\/example.com\" -I https:\/\/www.website.com\/image.jpg<\/pre>\n<p>You will get the following response.<\/p>\n<pre>HTTP\/1.1 403 Forbidden\nServer: nginx\/1.19.0 (Ubuntu)\n...<\/pre>\n<p>But please note, you can always directly access the same image. Here is the command to test it.<\/p>\n<pre>$ curl -I https:\/\/www.website.com\/image.jpg<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In this article, we have learnt how to stop image hotlinking to your site. As mentioned earlier, it is important to do this to prevent other websites from linking to your site&#8217;s images. We have learnt how to disable hotlinking from one site. You can also block hotlinking using other HTTP attributes such as IP address, user agent, domain, etc. On the other hand, you can also allow trusted search engines such as Google to hotlink to your images. Hopefully the above tutorial will help you prevent image hotlinking in NGINX.<\/p>\n<p><a href=\"http:\/\/ubiq.co\/\">Ubiq<\/a>\u00a0makes it easy to visualize data in minutes, and monitor in real-time dashboards.\u00a0<a href=\"http:\/\/ubiq.co\/accounts\/register\">Try it<\/a> today!<\/p>\n<p>Also read:<br \/>\n<a href=\"https:\/\/ubiq.co\/tech-blog\/setup-nginx-virtual-hosts-centos\/\">How to Setup NGINX Virtual Hosts on CentOS<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is important to prevent image hotlinking to save server resources and data bandwidth. Here&#8217;s how to prevent image hotlinking in NGINX web server.<\/p>\n","protected":false},"author":1,"featured_media":1536,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[8],"class_list":["post-1530","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nginx","tag-image-hotlinking"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Prevent Image Hotlinking in NGINX - Ubiq BI<\/title>\n<meta name=\"description\" content=\"It is important to prevent image hotlinking to save server resources and data bandwidth. Here&#039;s how to prevent image hotlinking in NGINX web server.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Prevent Image Hotlinking in NGINX - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"It is important to prevent image hotlinking to save server resources and data bandwidth. Here&#039;s how to prevent image hotlinking in NGINX web server.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-01T05:59:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-21T05:32:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/prevent-image-hotlinking-nginx.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"290\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Prevent Image Hotlinking in NGINX\",\"datePublished\":\"2020-09-01T05:59:30+00:00\",\"dateModified\":\"2025-08-21T05:32:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/\"},\"wordCount\":807,\"image\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/prevent-image-hotlinking-nginx.jpg?fit=800%2C290&ssl=1\",\"keywords\":[\"image hotlinking\"],\"articleSection\":[\"Nginx\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/\",\"url\":\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/\",\"name\":\"How to Prevent Image Hotlinking in NGINX - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/prevent-image-hotlinking-nginx.jpg?fit=800%2C290&ssl=1\",\"datePublished\":\"2020-09-01T05:59:30+00:00\",\"dateModified\":\"2025-08-21T05:32:42+00:00\",\"author\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"It is important to prevent image hotlinking to save server resources and data bandwidth. Here's how to prevent image hotlinking in NGINX web server.\",\"breadcrumb\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/prevent-image-hotlinking-nginx.jpg?fit=800%2C290&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/prevent-image-hotlinking-nginx.jpg?fit=800%2C290&ssl=1\",\"width\":800,\"height\":290,\"caption\":\"prevent image hotlinking in nginx\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ubiq.co\/tech-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Prevent Image Hotlinking in NGINX\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#website\",\"url\":\"https:\/\/ubiq.co\/tech-blog\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/\"],\"url\":\"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Prevent Image Hotlinking in NGINX - Ubiq BI","description":"It is important to prevent image hotlinking to save server resources and data bandwidth. Here's how to prevent image hotlinking in NGINX web server.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/","og_locale":"en_US","og_type":"article","og_title":"How to Prevent Image Hotlinking in NGINX - Ubiq BI","og_description":"It is important to prevent image hotlinking to save server resources and data bandwidth. Here's how to prevent image hotlinking in NGINX web server.","og_url":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2020-09-01T05:59:30+00:00","article_modified_time":"2025-08-21T05:32:42+00:00","og_image":[{"width":800,"height":290,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/prevent-image-hotlinking-nginx.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Prevent Image Hotlinking in NGINX","datePublished":"2020-09-01T05:59:30+00:00","dateModified":"2025-08-21T05:32:42+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/"},"wordCount":807,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/prevent-image-hotlinking-nginx.jpg?fit=800%2C290&ssl=1","keywords":["image hotlinking"],"articleSection":["Nginx"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/","url":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/","name":"How to Prevent Image Hotlinking in NGINX - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/prevent-image-hotlinking-nginx.jpg?fit=800%2C290&ssl=1","datePublished":"2020-09-01T05:59:30+00:00","dateModified":"2025-08-21T05:32:42+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"It is important to prevent image hotlinking to save server resources and data bandwidth. Here's how to prevent image hotlinking in NGINX web server.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/prevent-image-hotlinking-nginx.jpg?fit=800%2C290&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/prevent-image-hotlinking-nginx.jpg?fit=800%2C290&ssl=1","width":800,"height":290,"caption":"prevent image hotlinking in nginx"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/prevent-image-hotlinking-nginx\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Prevent Image Hotlinking in NGINX"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/09\/prevent-image-hotlinking-nginx.jpg?fit=800%2C290&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-oG","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/1530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=1530"}],"version-history":[{"count":20,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/1530\/revisions"}],"predecessor-version":[{"id":9230,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/1530\/revisions\/9230"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/1536"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=1530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=1530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=1530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}