Home Backend Development PHP Tutorial How to set up hosts on Mac computer (steps with pictures and text)

How to set up hosts on Mac computer (steps with pictures and text)

Apr 29, 2020 pm 10:27 PM
hosts

What is the hosts file?

The hosts file is a system file. By binding the relationship between the domain name and the IP, when the machine accesses the domain name, it will find the corresponding file from this file. If the record is found, the corresponding web page will be opened immediately. If not found, DNS public network resolution will be used to open the web page. Therefore, it is a good way to speed up access and local development and bind domain names.

Mac computer sets hosts local virtual domain name access steps:

Step 1: Find the terminal in the mac computer and open it (click on the upper left corner of the desktop [Magnifying glass] to "Search", enter "Term" or "term" and the "Terminal" will be displayed, and then open it.) As shown below :

How to set up hosts on Mac computer (steps with pictures and text)

Step 2: Input sudo vim /ect/hosts in the opened window and press "Enter key" Enter

How to set up hosts on Mac computer (steps with pictures and text)

Step 3:Enter the password set by your MAC computer and press Enter

How to set up hosts on Mac computer (steps with pictures and text)

The following content will be displayed

How to set up hosts on Mac computer (steps with pictures and text)

Step 4: In the input method English mode, enter i to enter the editing mode. This An INSERT will be displayed in the lower left corner. Press the down and right keys on the keyboard to move the cursor to the end of the last line, and then press Enter to start a new line. Enter 127.0.0.1 www.test.com as shown below This domain name can be replaced with your own domain name

How to set up hosts on Mac computer (steps with pictures and text)

Step 5:Then Press the ESC key , then enter :wq and press Enter. It will be automatically saved and you can end the editor.

In this way, the hosts domain name has been added successfully. You can check whether it takes effect by ping www.test.com.

At this point, the Mac computer has set up the hosts file and set up access to the local virtual domain name. This will make it much more convenient for us to develop and demonstrate the local website program. Hurry up and try it!

Note: phpstudy V8 PHP development integrated environment can be added to the local hosts file by default when adding a domain name, but currently only supports the Windows version. We look forward to the early development of the MAC version of phpstudy Finish!

The above is the detailed content of How to set up hosts on Mac computer (steps with pictures and text). For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

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)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What to do if changing hosts in Linux does not take effect What to do if changing hosts in Linux does not take effect Mar 27, 2023 am 10:08 AM

Solution to changing hosts in Linux does not take effect: 1. Find and open the "/etc/sysconfig/network" file; 2. Modify HOSTNAME to the corresponding alias, such as "NETWORKING=yes HOSTNAME=host1"; 3. Through "service network restart" command to restart the network service.

How to solve the problem that the hosts file is missing in Win10 system How to solve the problem that the hosts file is missing in Win10 system Jun 29, 2023 pm 08:33 PM

How to solve the problem that the hosts file in Win10 system is missing? The hosts file is a very important file in a Win10 computer. Recently, some friends found that their hosts file was missing when they wanted to modify the hosts file. So what should they do if they encounter this situation? Let’s take a look at how to recover the missing hosts file in Win10 system with the editor. How to recover the missing hosts file in Win10 system 1. Open C:WindowsSystem32driversetc; 2. Open the view option; 3. Remove the check mark in front of Hide protected operating system files and confirm; 4. Refresh and you will see the Hosts file.

How to solve the problem of being unable to modify the hosts file of Win10 Home Edition How to solve the problem of being unable to modify the hosts file of Win10 Home Edition Jan 14, 2024 pm 06:30 PM

As a user of Windows 10, have you encountered the dilemma of being unable to save changes when trying to modify the hosts file? This file can be regarded as a "database" that closely links the URL domain name and its corresponding IP address. So how to cleverly How to deal with this situation? What should I do if the hosts of Win10 Home Edition cannot be modified? 1. Press the Ctrl+C shortcut key to copy the following path: C:\Windows\System32\drivers\etc. 2. Paste this path into the address bar in the file manager and right-click the upper right corner of the folder where the hosts file is located. 3. Select the "File" menu, select the WindowsPowerShell option, and then a dialog box will pop up. 4

What are the consequences of deleting the hosts file? What are the consequences of deleting the hosts file? Mar 09, 2023 pm 02:42 PM

Deleting the hosts file has no effect; hosts is a system file without an extension, which can be opened with tools such as Notepad. Its function is to establish an associated "database" between some commonly used website domain names and their corresponding IP addresses; when the user is in When you enter a URL that requires login into the browser, the system will first automatically search for the corresponding IP address in the Hosts file. Once found, the system will immediately open the corresponding web page. If not found, the system will submit the URL to the DNS domain name resolution server. Perform IP address resolution.

The latest version of PowerToys 0.64.0 has been released, which includes a file locking tool, Hosts file editor and settings backup. The latest version of PowerToys 0.64.0 has been released, which includes a file locking tool, Hosts file editor and settings backup. May 08, 2023 pm 10:22 PM

Microsoft has released a new feature update for PowerToys. Version 0.64.0 is available for download now and includes two brand new utilities, settings backup and an extensive list of fixes. PowerToys 0.64.0 introduces a new FileLocksmith utility (shown below). It allows you to see which process or processes use selected files or folders, thereby preventing them from being deleted or modified. The second new tool provides a simple and convenient UI for editing Hosts files—no more digging into your system drive and opening Hosts in Notepad. You can view detailed information about processes and even end them if necessary. 0.64.0

Where is the location of the hosts file in Linux? Where is the location of the hosts file in Linux? May 27, 2023 pm 03:22 PM

The location of the hosts file in Linux hosts is a system file without an extension. Its function is to establish an associated "database" between some commonly used URL domain names and their corresponding IP addresses. When the user enters a URL that needs to be logged in in the browser, The system will first automatically search for the corresponding IP address in the Hosts file. Once found, the system will immediately open the corresponding web page. For all Linux operating system distributions, the hosts file is located at: /etc/hosts Extension content The hosts file (domain name resolution file [1]) is a computer file used to store information about each node in the computer network. This file is responsible for mapping host names to corresponding IP addresses. hosts file

Where is the location of the hosts file? Where is the location of the hosts file? Feb 03, 2023 pm 02:27 PM

The location of the hosts file is in the "etc" folder. The specific search method is: 1. Enter "Computer" from the desktop and double-click to open "C drive"; 2. Double-click to open "windows" -> "System32" -> "drivers" "-> "etc"; 3. Double-click to open the "etc" folder to find the "hosts" file.

What is the path to the windows hosts file What is the path to the windows hosts file Aug 31, 2022 pm 03:37 PM

The path of the hosts file is "C:\Windows\System32\drivers\etc". Hosts is a system file without an extension. Its function is to establish an associated "database" between some commonly used URL domain names and their corresponding IP addresses. When the user enters a URL that needs to be logged in in the browser, the system will first automatically start from Find the corresponding IP address in the Hosts file and open the corresponding web page; if not found, the system will submit the URL to the DNS domain name resolution server for IP address resolution.

See all articles