I am trying to block http://127.0.0.1:8080/ in C:\Windows\System32\drivers\etc host file. so what i did is:
127.0.0.5 http://127.0.0.1:8080/AccessCtrl/login.jsp
But is not working, i can still access this site.
As I know ,hosts file is for DNS caching .
I mean one side must be an IP address and the other side must be Domain name server. So you can't do such a thing.
The hosts file only maps domain names (e.g. www.example.com) to ip addresses.
Therefore your approach won't work for two reasons:
What you're trying to block is not a domain name, but a URL
The URL you're trying to block doesn't contain a domain name, but an IP address.
You should be able to "block" the domain "localhost" this way, but you'd still be able to access http://127.0.0.1:8080/, just not http://localhost:8080/.
What you need here is a firewall, like the windows firewall.
Related
I am working on a wordpress website and I'm unable to access my website using the host-name. [However, I'm able to access my website through the ip address. For example, when I enter 10.20.0.18, I'm directed to 10.20.0.18/wp-admin/plugins.php]
I am new to hosting and I was just able to update my hosts file and properly link the ip address to hostname by reading through some articles.
I also checked these links are correct using ping command.
For example, my hosts file looks something like this,
#Host file starts here
127.0.0.1 localhost
10.20.0.18 www.webserver.abc.com
66.155.40.202 api.wordpress.org
#End of host file
Now, when I try to access the website using hostname through my web browser, I get this error.
This site can’t be reached www.webserver.abc’s server IP address could not be found.
I am not sure where I am going wrong, or do I need to make some more changes in other files?
Is it possible to access website through IP address with path to index file instead of domain name?
Example:
Domain: Youtube.com
IP address: 216.58.209.142
Trying to access the website through IP address won't work. I understand this is because there can be multiple websites on the same IP address and the settings which directory gets sent to the user is set in nginx/apache.
Is it possible to visit the said website through for example 216.58.209.142/youtube/path/to/directory/index.html ?
If this works then how would I be able to get the full URL path?
Just curious, I'm not trying to achieve anything particular.
In general it's not possible.
Server can block your request even if you provide a correct/existing path, allowing you to access the data only using a correct domain name.
Just replace the www.youtube.com with YouTube's IP. For example: 216.58.209.142/index.html (I don't know if YouTube has index.html, but if it did that's how you would access it)
I want to add a subdomain to my server. I do have have an ip address given by the hosting server but I don't have the name domain yet. Is it possible to host like:
subdomain.152.235.235.85 <-- I tried this by Is not working for me, perhaps this is not possible
Or is there a better way to have subdomain without having a name domain yet?
If you want use this site for few devices, you can add to file hosts your domain: 152.235.235.85 subdomain.test.site
But just add subdomain to IP is impossible.
if I have an entry in my hosts file ,and also the hostname is in the server block of the nginx configure file ,I wonder which file is applied first and does what specific,could someone tell me ?
The hosts file is used by your OS to resolve hostnames to IPs and is usually evaluated first (can be customized - at least on unix based OS). If you tell an application to look for some host, e.g. www.example.com, it looks up the name in the hosts file and uses the IP to connect to that host. In case the hostname can't be found in the file, it will usually ask the configured DNS servers for it.. See Hosts File and DNS for more info.
The hostname in the server block on the other side is used by nginx to determine the appropriate action to be taken. nginx evaluates the HOST header in the request and tries to match it against the values configured in the server_name variables in each block. See Server names and How nginx processes a request.
Using IIS 7, I have an existing website, example.com, and I have added another website to which I'd like the URL, sub.example.com to point. I've set up the host headers for this, but it does not work. Trying to ping the subdomain URL give the message "Ping request could not find host sub.example.com. Please check the name and try again."
Should a DNS setting perhaps be set?
The subdomain must be set in the DNS or it will not resolve to an IP address. Just having it defined in IIS is not enough. The client computer must be able to translate the name into a meaningful server address.