These days to view the CNZZ statistics backstage See, my IP was two unknown domain name binding, in order to avoid being harmonious by the celestial,
Can be set on Nginx to prohibit IP access to the server, only through the binding domain name access (at the same time set the unbound domain name return 500 error or jump to my drop domain name home)
method is relatively simple,
Open nginx.conf
Step1 Binding website Domain name
Add a domain name to the server segment server_name row
server { a; server_name m114.org www.m114.org; Index index.html index.htm index.php; /data/htdocs/www;}
Step2 setting forbidden IP and unbound domain name access
Add the following code to the configuration file (entire paragraph)
① return 500 error
server { default; server_name _; return - ;}
② jump to your own domain homepage
server { default; server_name _; ^ (. *) http://m114.org permanent;}
Step3 Restart Nginx
In this way, the domain name and IP access not bound in Nginx will return 500 error or jump to my domain home page
Reprint: Http://m114.org/nginx%E7%A6%81%E6%AD%A2%E9%80%9A%E8%BF%87ip%E6%9C%AA%E7%BB%91%E5%AE%9A%E5%9F%9F%E5%90%8D%E8 %ae%bf%e9%97%ae%e6%9c%8d%e5%8a%a1%e5%99%a8/
Nginx is forbidden to access the server via IP, unbound domain name