how to disable direct access to a web site by ip address

前端 未结 8 1391
滥情空心
滥情空心 2021-01-31 02:17

I have a website on a VPS.

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

8条回答
  •  长情又很酷
    2021-01-31 03:08

    server {
        listen      80 default_server;
        listen      [::]:80 default_server;
        server_name "";
        return      444;
    }
    

    You need to specify default_server parameter so that all non available server requests goes to this server block which throws 444 error.

    444 : CONNECTION CLOSED WITHOUT RESPONSE

    ref: https://httpstatuses.com/444

提交回复
热议问题