search

What is the use of hosts

Feb 10, 2024 pm 07:57 PM
hosts fileuse

php editor Baicao hosts file is a configuration file used to map domain names and IP addresses. Its function is to perform domain name resolution on the computer and convert the domain name into an IP address, thereby enabling access to the website or service. By modifying the hosts file, functions such as blocking ads, accelerating access, and blocking malicious websites can be achieved. In addition, the hosts file can also be used to set up development and test environments to facilitate pointing the domain name to the local IP for debugging. In short, the hosts file plays a very important role in network access and development.

What is the use of hosts

#The main function of the Hosts file is to establish a correlation database between commonly used URL domain names and their corresponding IP addresses. When the user enters the URL that needs to be logged in in the browser, the system will automatically look for the corresponding IP address from the Hosts file. If it is found, the system will immediately open the corresponding web page; if it is not found, the system will submit the URL to the DNS domain name resolution server for IP address resolution. In this way, the Hosts file can improve web page access speed and reduce the load on the DNS server.

Note: The mapping configured in the Hosts file is static. If the computer on the network changes, please update the IP address in time, otherwise you will not be able to access it.

1. Solve the problem that some websites cannot be opened

Due to CDN acceleration failure, some acceleration nodes have problems. In order to solve the problem of being unable to access certain websites, we can directly point to the access node of the domain name by filling in the real available server IP address and URL in the Hosts file, bypassing the problematic acceleration node. In this way, you can successfully access those websites.

2. Speed ​​up domain name resolution

For websites that are frequently visited, we can improve the domain name resolution speed by configuring the mapping relationship between domain names and IPs in Hosts. Due to the mapping relationship, when we enter the domain name, the computer can quickly resolve the IP without requesting the DNS server on the network.

3. Smooth connection to the system

For Lotus servers and some database servers, if you directly enter the IP address during access, you cannot access it. You can only access it by entering the server name. Then we configure the Hosts file so that we can connect smoothly by entering the server name.

4. Virtual domain name

Many times, website builders need to build the "soft environment" before uploading and debugging. But similar to the mail service, you need to use a domain name to assist debugging. In this case, you can point the local IP address to a "virtual domain name" to achieve the required effect without any cost.

5. Block websites (domain name redirection)

There are many websites that install various plug-ins into your computer without the user’s consent. Some of them may be Trojan horses or Virus. For these websites, we can use Hosts to map the domain name of the website to the wrong IP or the IP of the local computer, so that there is no need to access it. In the WINDOWS system, it is agreed that 127.0.0.1 is the IP address of the local computer, and 0.0.0.0 is the wrong IP address. If we write the following content in Hosts: 127.0.0.1 The domain name of website A to be blocked 0.0.0.0 The domain name of website B to be blocked In this way, when the computer resolves domain names A and B, it will resolve to the local IP or error IP, achieving the purpose of blocking websites A and B.

6. Convenient for LAN users

In the LAN of many units, there will be servers available for users to use. However, since DNS servers are rarely set up in local area networks, when accessing these servers, you have to enter IP addresses that are difficult to remember. This is quite troublesome for many people. You can give these servers names that are easy to remember, and then establish IP mapping in Hosts, so that when you visit in the future, you only need to enter the name of the server.

The above is the detailed content of What is the use of hosts. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:卡饭网. If there is any infringement, please contact admin@php.cn delete
Trump Just Delayed the TikTok Ban (Again)Trump Just Delayed the TikTok Ban (Again)Apr 11, 2025 am 10:48 AM

TikTok's US ban is again delayed, this time until June 18th. President Trump announced on Truth Social a new executive order extending the deadline by 75 days, allowing more time for ByteDance to find a US buyer. This marks the second delay of the P

Can you get paid to take pictures for Google Maps?Can you get paid to take pictures for Google Maps?Apr 10, 2025 am 09:36 AM

You can make money taking photos for GoogleMaps. Accumulate points by joining the GoogleMaps Local Wizard Program to upload high-quality photos and comments, which can be redeemed for GooglePlay points and other rewards.

Why is Google Maps full of ads?Why is Google Maps full of ads?Apr 09, 2025 am 12:18 AM

The reason why GoogleMaps is full of advertising is that its business model needs to cover operational costs through advertising. 1) Google maintains free services by embedding various forms of ads in -maps. 2) Users can manage ads by identifying results with “sponsored” or “advertising” tags. 3) Tips to improve the user experience include using offline maps and "Explore" functions.

What do Google Maps drivers get paid?What do Google Maps drivers get paid?Apr 08, 2025 am 12:14 AM

Google Maps drivers earn money including base salary and bonuses calculated by kilometers. Their salary structure is based on a contract system, with a base salary of about $3,000 per month, a bonus of $0.1 per kilometer, and additional bonuses can be obtained when driving at night.

What are Google local ads?What are Google local ads?Apr 07, 2025 am 12:14 AM

Google Local Ads helps businesses increase local market exposure and attract potential customers through bidding, quality scores and geolocation data. 1. To create a local advertising campaign, you need to set up a bidding strategy and budget. 2. Advanced usage can dynamically adjust bidding according to time period. 3. Optimization strategies include keywords, advertising copy, bidding and geolocation optimization to improve exposure and conversion rates.

How much does the Google Maps guy get paid?How much does the Google Maps guy get paid?Apr 06, 2025 am 12:03 AM

GoogleMapsGuy's average annual salary ranges from $50,000 to $70,000. Their job includes driving or hiking to take street scene images and uploading them to Google servers, with salaries varying by region, experience and responsibilities.

The Four Best Alternatives to ZelleThe Four Best Alternatives to ZelleApr 05, 2025 am 10:29 AM

Zelle's standalone app is gone, but its peer-to-peer payment functionality lives on within many banking apps. Check if your bank supports Zelle using their search tool; over 2,200 banks already have it integrated. If not, consider these top Zelle a

Can you do ads on Google Maps?Can you do ads on Google Maps?Apr 05, 2025 am 12:10 AM

GoogleMaps supports ad serving. 1) Create local ads through GoogleAds, 2) Set up ad campaigns, select the "local" type, 3) Optimize ad copywriting and bidding strategies, 4) Use ad extensions and smart bids to improve the effectiveness, 5) Regularly monitor and adjust advertising strategies to improve local customer appeal.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version