IIS

Window Server 2019 IIS 가상호스트 1개 생성

hippo 데브옵스 2023. 9. 17. 17:30
  • 서버 하나에 홈페이지 하나를 구성하는 게 가장 단순한 방법이지만, 사이트 하나만 운영하기에는 서버의 자원이 남음 → 여러 홈페이지를 하나의 서버에 만들 수 있음
  • 여러 홈 페이지를 구성하는 설정을 가상 호스트로 관리함
  • 여러 가상호스트를 만들 수 있지만, 우선적으로 Windows Server 2019의 IIS에서 하나의 가상호스트(도메인)를 구성하고 테스트를 진행 예정
  • 생성할 테스트 도메인 : hippo-iis-test.aaa.com(테스트용으로 사용 불가)


1. 가상호스트(hippo-iis-test.aaa.com)에서 사용할 hippo-iis-test.aaa.com 이름의 폴더 만들기

  • 사이트 내용이 들어갈 폴더를 생성
  • IIS 기본 폴더인 inetpub 안에 hippo-iis-test.aaa.com 이름을 가지는 폴더를 생성
  • 폴더 위치나 폴더 이름은 달라도 상관 없음


2. index.html 만들기

  • hippo-iis-test.aaa.com 폴더 안에 이동 후 index.html 파일 오픈

    PS C:\inetpub\hippo-iis-test.aaa.com> pwd
    
    Path
    ----
    C:\inetpub\hippo-iis-test.aaa.com
    
    PS C:\inetpub\hippo-iis-test.aaa.com> cd C:\inetpub\hippo-iis-test.aaa.com
    PS C:\inetpub\hippo-iis-test.aaa.com> pwd
    
    Path
    ----
    C:\inetpub\hippo-iis-test.aaa.com

  • hippo-iis-test.aaa.com 폴더 안에 아래과 같은 내용의 index.html 파일을 생성

    PS C:\inetpub\hippo-iis-test.aaa.com> notepad index.html
    <!doctype html>
    <html lang="en">
      <head>
        <meta charset="UTF-8">
        <title>IIS</title>
      </head>
      <body>
        <h1>HELLO HIPPO</h1>
      </body>
    </html>

  • index.html 파일 생성 확인



3. 사이트 추가하기

  • IIS(인터넷 정보 서비스) 관리자를 오픈

  • 왼쪽 패널에서 사이트를 선택한 후 오른쪽에서 [웹 사이트 추가]를 클릭


  • 사이트 이름을 적절히 명명하면 됨. → 호스트 이름과 동일하게 생성 예정(hippo-iis-test.aaa.com)

  • 실제 경로는 해당 사이트 내용이 들어갈 폴더를 선택 → C:\inetpub\hippo-iis-test.aaa.com

  • 바인딩의 호스트 이름에 도메인 이름을 입력 → hippo-iis-test.aaa.com

  • [확인]을 클릭


  • 가상호스트 생성 완료



4. index.html 접속 테스트

5. mp4 파일 이동 후 접속 테스트

  • izone.mp4 파일 이동 후 접속 테스트 : http://hippo-iis-test.aaa.com/izone.mp4

  • izone.mp4 파일을 C:\inetpub\hippo-iis-test.aaa.com 폴더로 이동

    PS C:\> cd C:\Users\Administrator\Downloads
    PS C:\Users\Administrator\Downloads> cp .\izone.mp4 C:\inetpub\hippo-iis-test.aaa.com\
    PS C:\Users\Administrator\Downloads> cd C:\inetpub\hippo-iis-test.aaa.com\
    PS C:\inetpub\hippo-iis-test.aaa.com> ls
    
        Directory: C:\inetpub\hippo-iis-test.aaa.com
    
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----       11/22/2022   8:32 AM            162 index.html
    -a----       11/22/2022   5:46 AM      782287199 izone.mp4