{"id":1140,"date":"2017-10-12T18:12:54","date_gmt":"2017-10-12T13:12:54","guid":{"rendered":"http:\/\/alexeyka.zantsev.com\/?p=1140"},"modified":"2017-10-13T15:44:37","modified_gmt":"2017-10-13T10:44:37","slug":"lighttpd-mod_access","status":"publish","type":"post","link":"https:\/\/alexeyka.zantsev.com\/?p=1140","title":{"rendered":"Lighttpd: mod_access"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/upload.wikimedia.org\/wikipedia\/en\/7\/78\/Lighttpd_logo.svg\" width=\"120\" height=\"120\" alt=\"lighttpd_logo\" align=\"left\" \/> I faced a problem when it was needed to allow access to certain url (x.x.x.x\/zabbix\/) for 2 fixed IP-addresses and one \/16 subnet, and deny to anybody else.<\/p>\n<p>The old examples from the official documentation worked not so perfect as I wanted <a href=\"https:\/\/redmine.lighttpd.net\/boards\/2\/topics\/1279\">https:\/\/redmine.lighttpd.net\/boards\/2\/topics\/1279<\/a><br \/>\nBut the users helped me in the same topic.<\/p>\n<p>This is how it&#8217;s done:<\/p>\n<pre>\r\n$HTTP[\"url\"] =~ \"^\/zabbix\/\" {\r\n    $HTTP[\"remoteip\"] == \"55.222.0.0\/16\" {\r\n    }\r\n    else $HTTP[\"remoteip\"] == \"11.22.33.44\" {\r\n    }\r\n    else $HTTP[\"remoteip\"] == \"55.66.77.88\" {\r\n    }\r\n    else $HTTP[\"remoteip\"] != \"\" {  # (dummy match everything)\r\n        url.access-deny = ( \"\" )\r\n    }\r\n}\r\n<\/pre>\n<p>Now anybody accessing \/zabbix\/ will get &#8220;403&#8221; error except 11.22.33.44 , 55.66.77.88 and 55.222.0.0\/16.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I faced a problem when it was needed to allow access to certain url (x.x.x.x\/zabbix\/) for 2 fixed IP-addresses and one \/16 subnet, and deny to anybody else. The old examples from the official documentation worked not so perfect as I wanted https:\/\/redmine.lighttpd.net\/boards\/2\/topics\/1279 But the users helped me in the same topic. This is how [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[235],"class_list":["post-1140","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-lighttpd"],"_links":{"self":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/1140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1140"}],"version-history":[{"count":8,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/1140\/revisions"}],"predecessor-version":[{"id":1154,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/1140\/revisions\/1154"}],"wp:attachment":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}