윈도우 Host 파일 수정 / 특정 도메인 요청을 localhost로 전송하는 방법

개발서버 도메인으로 나가는 요청을 localhost로 전달할 수 있습니다.
호스트 파일은 로컬에서만 적용됩니다.


호스트 파일 수정 방법

메모장 검색 > 관리자 권한으로 실행 > 파일 > 열기 > C:\Windows\System32\drivers\etc > 모든 파일 (.) 확장자 보기 > hosts 파일 열기 > 수정 및 저장

호스트 파일 수정 예시

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost

# 추가
127.0.0.1 www.개발서버도메인.co.kr

도메인으로 들어오는 요청에 대해서 IP로 이동하도록 설정을 추가합니다.

Leave a comment