ip와 호스트 맵핑

: 가끔 아이피와 호스트 맵핑을 해두지 않아서 접속이 안되는 경우가 발생

: 크롬에서 캐시 및 쿠키 정보 삭제 후 갑자기 로컬호스트 접속 안되는 현상 발생


1. Windows > System32 > drivers > etc 폴더hosts 파일 편집


2. hosts 파일에 호스트 정보와 ip정보 등록 맵핑 시킨다.





출처 : http://veldise.tistory.com/56




localhost 로 접속이 되질 않는 문제 발생



졸업작품을 진행하면서, 서버를 구축해야 될 일이 생겨 오랜만에 톰캣을 설치하였습니다.

기본적인 환경은 이전에 백업을 해 두었기에 그냥 인스톨만 하면 끝나는 것이었는데, 

위 그림과 같이 localhost로 접속이 되질 않는 문제가 발생하더군요.



환경변수/서비스/톰캣 설정/JDK버전 모두 확인해 보았으나 이상 없음.

이 과정에서 127.0.0.1 (localhost에 대응하는 주소)를 쳤을 때는 접속이 잘 되는 것을 확인하고

구글링을 통해 hosts 설정하는 법을 알아내어 확인해보았습니다.



C:\Windows\System32\drivers\etc\hosts 파일 내용 중 일부분


저 빨간 밑줄을 쳐 놓은 부분이 문제였더군요.

원래대로라면 127.0.0.1 이어야 하는 부분이 괴상하게 0.0.0.0 으로 되어있었습니다.

수정해주니 곧바로 잘 되는군요.



요약하자면, 

127.0.0.1로는 접속/연결이 되나 localhost로 접속/연결이 되지 않는 경우

시작-실행-%systemroot%\System32\drivers\etc 입력 후 확인

또는

C:\Windows\System32\drivers\etc

를 찾아가서 hosts 파일을 메모장이나 문서편집기 등으로 열어

127.0.0.1                 localhost

과 같은 형태가 되도록 수정한다.



잘 모르시겠다면 다음 텍스트를 복사(ctrl+c)하셔서 hosts 파일로 덮어쓰기(ctrl+a 후 ctrl+v) 하시면 됩니다.


# 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


Posted by airlueos
,