如何禁用ip地址直接访问网站 [英] how to disable direct access to a web site by ip address
本文介绍了如何禁用ip地址直接访问网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在VPS上有一个网站。
I have a website on a VPS.
我遇到的问题是,当我输入服务器的IP时,它会链接到网站。 >
即使进入mail.domain.com,它也会做同样的事情。
The issue I am having is that when I enter the IP of the server, it links to the website.
Even when entering mail.domain.com, it does the same thing.
如何禁用它,以便访问者收到消息或者是直接到域?
How do I disable that, so a visitor would get a message or be directed to the domain?
我尝试禁用IP并在云端闪存上发送一条记录,但它没有用。
I tried disabling the IP and mail a record on cloud flare but it didn't work.
我的设置是:
VPS on Linux Debian
Nginx
no control panel just command line
Cloudflare
DNS setup with BIND
推荐答案
你可以使用redirect,nginx config:
You can use redirect, nginx config:
server {
listen 80;
server_name IP_ADDRESS;
return 301 http://YOUR.DOMAIN;
}
这篇关于如何禁用ip地址直接访问网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文