CryptoTex
CryptoTex

Reputation: 13

How to block AWS elastic IP and Public DNS from resolving http requests

I have spawn an ec2 instance on aws with a web server stack. It has an elastic ip atached to it. Nameservers are set with a domain and pointing to the elastic ip, which resolves http requests on port 80, works great.

BUT how can directly putting in the elastic ip and the aws dns directly into the browser still resolves the website. Whats the best way to block these resolving the site directly. Like other hosts do for example. A domain name is attached to the ip but when you request the ip directly it gets an error 404. How would you do that!? Is this an apache setting rather than an aws?

THanks.

Upvotes: 0

Views: 183

Answers (1)

b.b3rn4rd
b.b3rn4rd

Reputation: 8840

That would be your nginx or apache configuration, probably you only have the default virtualhost which handles all requests.

For nginx: http://nginx.org/en/docs/http/server_names.html

For apache: https://httpd.apache.org/docs/2.4/vhosts/name-based.html

Upvotes: 1

Related Questions