如何禁用ip地址直接访问网站

编程入门 行业动态 更新时间:2024-10-14 22:21:13
本文介绍了如何禁用ip地址直接访问网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在VPS上有一个网站。

I have a website on a VPS.

我遇到的问题是,当我输入服务器的IP时,它会链接到网站。 > 即使进入mail.domain,它也会做同样的事情。

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, 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 YOUR.DOMAIN; }

更多推荐

如何禁用ip地址直接访问网站

本文发布于:2023-11-01 13:25:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549442.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:地址   网站   ip

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!