Skip to content

Local host file mapping

Local host file mapping is a network configuration practice used to associate specific hostnames with IP addresses on a local machine. This is typically achieved by manually editing the hosts file on the operating system.^[400-devops-10-version-control-readme.md]

Usage

Developers and system administrators commonly use this technique to mimic production environments locally. By mapping a domain name to a local IP address (such as 127.0.0.1), services can be accessed via a consistent URL without requiring DNS propagation.^[400-devops-10-version-control-readme.md]

For example, in a local development stack involving containers or virtual machines, services like a CI server or a Git hosting service might be mapped as follows:

127.0.0.1 drone-server
127.0.0.1 gitea-server
^[400-devops-10-version-control-readme.md]

This configuration allows the user to navigate to http://drone-server in a browser, which resolves to the local machine.^[400-devops-10-version-control-readme.md]

Configuration

While the mapping is defined in the local host file, the receiving service often requires specific internal configuration to recognize and handle the mapped hostname correctly. For instance, when setting up a service like Gitea, it is necessary to research and configure settings such as LOCAL_ROOT_URL or server domain definitions found in configuration examples.^[400-devops-10-version-control-readme.md]

  • [[DNS]]
  • DevOps
  • [[Localhost]]

Sources

^[400-devops-10-version-control-readme.md]