简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM