1.禁止IP访问直接返回错误
[root@web01 /etc/nginx/conf.d]# vim a_ip.conf
server {
listen 80 default_server;
server_name localhost;
return 500;
}
2.引流的方式跳转页面
[root@web01 /etc/nginx/conf.d]# vim a_ip.conf
server {
listen 80 default_server;
server_name localhost;
rewrite (.*) http://www.baidu.com$1;
#return 302 http://www.baidu.com$request_uri;
}
3.返回指定内容
[root@web01 /etc/nginx/conf.d]# vim a_ip.conf
server {
listen 80 default_server;
server_name localhost;
default_type text/plain;
return 200 "请请求其他页面...或使用域名请求!";
}