有些時候我們希望系統只能通過固定的域名訪問,禁止IP或者惡意綁定的域名訪問。
下面的nginx配置,假如host變量不是指定的域名,將返回403。
1 server { 2 listen 80; 3 server_name newcoina.xgyxserv.com; 4 5 if ($host != 'newcoina.xgyxserv.com'){ 6 return 403; 7 } 8 9 location / { 10 root /www; 11 } 12 }
有些時候我們希望系統只能通過固定的域名訪問,禁止IP或者惡意綁定的域名訪問。
下面的nginx配置,假如host變量不是指定的域名,將返回403。
1 server { 2 listen 80; 3 server_name newcoina.xgyxserv.com; 4 5 if ($host != 'newcoina.xgyxserv.com'){ 6 return 403; 7 } 8 9 location / { 10 root /www; 11 } 12 }
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。