nginxã®geoã¢ã¸ã¥ã¼ã«ã便å©ããã
ãªã«ãã§ããã®ï¼
REMOTE_ADDRãåæãã¦å¤æ°ã«æ ¼ç´ã§ãã¾ãã
è¨å®ãã¦ã¿ã
ç¹å®ã®IPããã¢ã¯ã»ã¹ãããããªãã³ã³ãã³ããããã¨ãã¾ãã
ä»åã¯ä¾ã¨ãã¦ã/adminã以ä¸ã¸ã®ã¢ã¯ã»ã¹ã¯ãã¼ã«ã«ãããã¯ã¼ã¯ããã®ã¢ã¯ã»ã¹ã®ã¿ã許å¯ããã¾ãã
http { ã» ã» ã» geo $access_allowed { default disable; 127.0.0.1 allow; 192.168.0.0/24 allow; } ã» ã» ã» server { ã» ã» ã» location /admin { if ($access_allowd = "disable") { return 404; } } ã» ã» ã» } }
ã¢ã¯ã»ã¹è¨±å¯å¯¾è±¡ãå¢ããããå ´åã¯geoãã£ã¬ã¯ãã£ãã«IPã追å ããã ãã
ããã«ã¬ã¹ãã³ã¹ã³ã¼ããæå®ã§ããã®ãã¤ã¤ã§ããã
Apacheã§ãããã¨ããå ´åã¯mod_rewriteã§ãã«ããã«ãããªãããããªãã£ãã®ã§ããããªã楽ãªè¨å®ã§ãã
ããã¥ã¡ã³ã
http://nginx.org/en/docs/http/ngx_http_geo_module.html
ãã°ããã¯nginxãã¿ãç¶ãã¨æãã¾ãã