Disable direct access via static IP address to my website

0

Hi,

I have an AWS lightsail instance and now I can access to my website via domain and static IP address. I want to disable access to my website via IP address and keep access via domain name. Please, could you help me how can I do that?

Thanks in Advance

질문됨 2년 전250회 조회
1개 답변
1

Edit: Corrected the answer so that it actually makes sense.

When a HTTP/HTTPS request is made to your web server, one of the headers passed is Host. If someone is using a browser and types http://www.example.com/ then you'll see www.example.com in the Host header. If they type http://1.2.3.4 then you'll see 1.2.3.4.

So what you can do is configure your web server only to serve up your website when the Host header is your domain name. What you'd also generally do is configure it to serve a static page (which could be blank, it could show an error, it could be any HTML) for people accessing the web server with any other hostname.

It depends on which web server software you're using, but for example: with Apache you'd configured this using the VirtualHost directive.

profile pictureAWS
전문가
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠