{"id":626,"date":"2020-05-04T10:33:05","date_gmt":"2020-05-04T10:33:05","guid":{"rendered":"http:\/\/ubiq.co\/tech-blog\/?p=626"},"modified":"2025-08-12T04:36:54","modified_gmt":"2025-08-12T04:36:54","slug":"how-to-whitelist-ip-in-nginx","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/","title":{"rendered":"How To Whitelist IP in Nginx"},"content":{"rendered":"<p>NGINX allows you to Whitelist IP addresses as well as IP ranges to your website, and allow access to only specific people in your business. Here&#8217;s how to whitelist IP in NGINX. We will also look at how to whitelist IP range for domain, subdomain and URL. This is useful if your website contains sensitive information that you don&#8217;t want to share publicly, and for corporate websites.<\/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\/how-to-whitelist-ip-in-nginx\/#How_To_Whitelist_IP_in_Nginx\" >How To Whitelist IP in Nginx<\/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\/how-to-whitelist-ip-in-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-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/#2_Whitelist_IP_in_NGINX\" >2. Whitelist IP 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\/how-to-whitelist-ip-in-nginx\/#Whitelist_IP_in_NGINX_for_domain\" >Whitelist IP in NGINX for domain<\/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\/how-to-whitelist-ip-in-nginx\/#Whitelist_IP_in_NGINX_for_subdomain\" >Whitelist IP in NGINX for subdomain<\/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\/how-to-whitelist-ip-in-nginx\/#Whitelist_IP_range_in_NGINX\" >Whitelist IP range in NGINX<\/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\/how-to-whitelist-ip-in-nginx\/#Whitelist_IP_in_NGINX_for_URL\" >Whitelist IP in NGINX for URL<\/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\/how-to-whitelist-ip-in-nginx\/#Whitelist_Multiple_IP_in_NGINX\" >Whitelist Multiple IP in NGINX<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/#3_Restart_NGINX\" >3. Restart NGINX<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"How_To_Whitelist_IP_in_Nginx\"><\/span>How To Whitelist IP in Nginx<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Here are the steps to whitelist IP 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>If you are using NGINX&#8217;s main configuration file nginx.conf, without virtual hosts, then run the following command<\/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.example.com), such as \/etc\/nginx\/sites-enabled\/example.conf then open its configuration with the following command<\/p>\n<pre>$ sudo vi\u00a0\/etc\/nginx\/sites-enabled\/example.conf<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"2_Whitelist_IP_in_NGINX\"><\/span>2. Whitelist IP in NGINX<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>There are multiple ways to whitelist IP in NGINX. We will look at each of them. If you want to whitelist IP 45.43.23.21 for domain or your entire website, you can add the following lines in your configuration file.<\/p>\n<pre><strong>allow<\/strong>\u00a045.43.23.21;\n<strong>deny all<\/strong>;\n<\/pre>\n<p>The above lines will make NGINX deny all except IP 45.43.23.21. The first line\u00a0<em>allow\u00a045.43.23.21<\/em> will allow access from that IP.\u00a0<em>deny<\/em> all will block all other IPs.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Whitelist_IP_in_NGINX_for_domain\"><\/span>Whitelist IP in NGINX for domain<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Add the above lines in any of the <em>http<\/em>, server or <em>location<\/em> \/ blocks as shown below<\/p>\n<pre><strong>http<\/strong>{\n   ...\n   allow\u00a045.43.23.21;\n   deny all;\n   ...\n}\n\n<strong>server<\/strong>{\n    ...\n    allow\u00a045.43.23.21;\n    deny all;\n    ...\n}\n\n\n<strong>location \/<\/strong> {\n   allow\u00a045.43.23.21;\n   deny all;\n}\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Whitelist_IP_in_NGINX_for_subdomain\"><\/span>Whitelist IP in NGINX for subdomain<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Let&#8217;s say you have two subdomains (<em>blog.example.com<\/em> and <em>articles.example.com<\/em>) with their NGINX config files at <em>\/etc\/nginx\/sites-enabled\/blog.conf<\/em> and\u00a0<em>\/etc\/nginx\/sites-enabled\/articles.conf<\/em><\/p>\n<p>If you want to whitelist IP in NGINX for only 1 subdomain (e.g blog.example.com) then place the above-mentioned 2 lines in blog.conf file of that subdomain<\/p>\n<pre>$ sudo vim\u00a0\/etc\/nginx\/sites-enabled\/blog.conf\n<\/pre>\n<pre>server {\n  server <strong>blog.example.com<\/strong>;\n  <strong>allow 45.43.23.21;\n  deny all;<\/strong>\n}<\/pre>\n<p>If you want to whitelist IP in both subdomains, then add the 2 lines in both <em>blog.conf<\/em>\u00a0and <em>articles.conf<\/em> files.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Whitelist_IP_range_in_NGINX\"><\/span>Whitelist IP range in NGINX<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If you want to allow an IP range such as 45.43.23.0 &#8211; 45.43.23.255, then use the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Classless_Inter-Domain_Routing#CIDR_notation\" target=\"_blank\" rel=\"noopener\">CIDR format<\/a> for your IP range, since NGINX accepts only IP addresses and CIDR formats. You can get the CIDR for your IP address range using <a href=\"https:\/\/www.ipaddressguide.com\/cidr\" target=\"_blank\" rel=\"noopener\">IP to CIDR tools<\/a>.<\/p>\n<pre>location \/ {\n  allow\u00a0<strong>45.43.23.0\/24<\/strong>;\n  deny all;\n}\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Whitelist_IP_in_NGINX_for_URL\"><\/span>Whitelist IP in NGINX for URL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If you want to whitelist IP for just one URL (e.g \/accounts\/login) then add the above <em>allow<\/em>\u00a0directive in\u00a0<em>location<\/em> block of that URL.<\/p>\n<pre>location\u00a0<strong>\/accounts\/login<\/strong> {\n   allow\u00a045.43.23.21;\n   deny all;\n}\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Whitelist_Multiple_IP_in_NGINX\"><\/span>Whitelist Multiple IP in NGINX<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If you want to whitelist multiple IP in NGINX to allow access to multiple IP addresses, just add multiple <em>allow<\/em> directives as shown below, one for each IP<\/p>\n<pre><strong>allow<\/strong>\u00a045.43.23.21;\n<strong>allow<\/strong>\u00a044.23.13.10;\n<strong>deny all<\/strong>;<\/pre>\n<p>You can also combine IP and CIDR ranges together, as shown below<\/p>\n<p>If you want to whitelist multiple IP in NGINX to allow access to multiple IP addresses, just add multiple <em>allow<\/em> directives as shown below, one for each IP<\/p>\n<pre><strong>allow<\/strong>\u00a044.23.13.10;\n<strong>allow<\/strong>\u00a045.43.23.0\/24;\n<strong>deny all<\/strong>;<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"3_Restart_NGINX\"><\/span>3. Restart NGINX<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>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<p>That&#8217;s it! Now NGINX will allow access to only those IP addresses and ranges mentioned in your configuration file.<\/p>\n<p>By the way, if you want to create charts &amp; dashboards to monitor your business or website, you can try <a href=\"https:\/\/ubiq.co\">Ubiq<\/a>. We offer a 14-day free trial.<\/p>\n<p>Also read:<\/p>\n<p><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-uninstall-nginx\/\">How to Uninstall NGINX<\/a><br \/>\n<a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-password-protect-directory-in-nginx\/\">How to Password Protect Directory in NGINX<\/a><br \/>\n<a href=\"https:\/\/ubiq.co\/tech-blog\/nginx-restrict-access-to-directory-and-subdirectories\/\">NGINX Restrict Access to Directory &amp; Subdirectories<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>NGINX allows you to whitelist IP addresses and allow access to specific IP ranges. Here&#8217;s how to whitelist IP in NGINX for domain, subdomain, URL, location.<\/p>\n","protected":false},"author":1,"featured_media":632,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[50,51,52,53,49],"class_list":["post-626","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nginx","tag-allow","tag-domain","tag-subdomain","tag-url","tag-whitelist"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Whitelist IP in Nginx - Ubiq BI<\/title>\n<meta name=\"description\" content=\"NGINX allows you to whitelist IP and allow access to specific IP ranges. Here&#039;s how to whitelist IP in NGINX for domain, subdomain, URL, location.\" \/>\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\/how-to-whitelist-ip-in-nginx\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Whitelist IP in Nginx - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"NGINX allows you to whitelist IP and allow access to specific IP ranges. Here&#039;s how to whitelist IP in NGINX for domain, subdomain, URL, location.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-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-05-04T10:33:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-12T04:36:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/05\/how-to-whitelist-ip-in-nginx.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1400\" \/>\n\t<meta property=\"og:image:height\" content=\"650\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-whitelist-ip-in-nginx\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-whitelist-ip-in-nginx\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How To Whitelist IP in Nginx\",\"datePublished\":\"2020-05-04T10:33:05+00:00\",\"dateModified\":\"2025-08-12T04:36:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-whitelist-ip-in-nginx\\\/\"},\"wordCount\":563,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-whitelist-ip-in-nginx\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/how-to-whitelist-ip-in-nginx.png?fit=1400%2C650&ssl=1\",\"keywords\":[\"allow\",\"domain\",\"subdomain\",\"url\",\"whitelist\"],\"articleSection\":[\"Nginx\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-whitelist-ip-in-nginx\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-whitelist-ip-in-nginx\\\/\",\"name\":\"How To Whitelist IP in Nginx - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-whitelist-ip-in-nginx\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-whitelist-ip-in-nginx\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/how-to-whitelist-ip-in-nginx.png?fit=1400%2C650&ssl=1\",\"datePublished\":\"2020-05-04T10:33:05+00:00\",\"dateModified\":\"2025-08-12T04:36:54+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"NGINX allows you to whitelist IP and allow access to specific IP ranges. Here's how to whitelist IP in NGINX for domain, subdomain, URL, location.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-whitelist-ip-in-nginx\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-whitelist-ip-in-nginx\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-whitelist-ip-in-nginx\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/how-to-whitelist-ip-in-nginx.png?fit=1400%2C650&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/how-to-whitelist-ip-in-nginx.png?fit=1400%2C650&ssl=1\",\"width\":1400,\"height\":650,\"caption\":\"how to whitelist ip in nginx\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-whitelist-ip-in-nginx\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Whitelist IP 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 Whitelist IP in Nginx - Ubiq BI","description":"NGINX allows you to whitelist IP and allow access to specific IP ranges. Here's how to whitelist IP in NGINX for domain, subdomain, URL, location.","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\/how-to-whitelist-ip-in-nginx\/","og_locale":"en_US","og_type":"article","og_title":"How To Whitelist IP in Nginx - Ubiq BI","og_description":"NGINX allows you to whitelist IP and allow access to specific IP ranges. Here's how to whitelist IP in NGINX for domain, subdomain, URL, location.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2020-05-04T10:33:05+00:00","article_modified_time":"2025-08-12T04:36:54+00:00","og_image":[{"width":1400,"height":650,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/05\/how-to-whitelist-ip-in-nginx.png","type":"image\/png"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How To Whitelist IP in Nginx","datePublished":"2020-05-04T10:33:05+00:00","dateModified":"2025-08-12T04:36:54+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/"},"wordCount":563,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/05\/how-to-whitelist-ip-in-nginx.png?fit=1400%2C650&ssl=1","keywords":["allow","domain","subdomain","url","whitelist"],"articleSection":["Nginx"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/","name":"How To Whitelist IP in Nginx - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/05\/how-to-whitelist-ip-in-nginx.png?fit=1400%2C650&ssl=1","datePublished":"2020-05-04T10:33:05+00:00","dateModified":"2025-08-12T04:36:54+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"NGINX allows you to whitelist IP and allow access to specific IP ranges. Here's how to whitelist IP in NGINX for domain, subdomain, URL, location.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/05\/how-to-whitelist-ip-in-nginx.png?fit=1400%2C650&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/05\/how-to-whitelist-ip-in-nginx.png?fit=1400%2C650&ssl=1","width":1400,"height":650,"caption":"how to whitelist ip in nginx"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-whitelist-ip-in-nginx\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How To Whitelist IP 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\/05\/how-to-whitelist-ip-in-nginx.png?fit=1400%2C650&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-a6","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/626","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=626"}],"version-history":[{"count":23,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/626\/revisions"}],"predecessor-version":[{"id":9054,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/626\/revisions\/9054"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/632"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}