Windows Server IIS 서버 구성 가이드

Windows Server IIS 구성 가이드입니다. IIS/FTP 역할 설치, 서비스와 방화벽 확인, 기본 사이트, FTP site, IP 기반 웹사이트 binding과 로그 확인을 정리했습니다.

Windows Server IIS 서버 구성 가이드

IIS(Internet Information Services)는 Windows Server에 포함된 웹 서버 플랫폼이다. 실습은 IIS 설치, FTP 구성, 다른 IP별로 다른 사이트를 띄우는 실습까지 포함하고 있었지만 대부분 GUI 화면 중심이었다. 여기서는 Server Manager에서 진행하는 흐름을 PowerShell 명령과 검증 절차로 함께 확인한다.

이 글에서는 IIS 기본 웹 서버, FTP, 방화벽, 기본 DocumentRoot, IP 기반 site binding을 다룬다. 같은 IP에서 host header로 여러 사이트를 구분하는 내용은 별도 글인 IIS 서버 2 구성에서 다룬다.

실습 주소 계획

항목예시
웹 서버 기본 IP192.168.10.199
추가 IP192.168.10.196
기본 웹 루트C:\inetpub\wwwroot
FTP 루트C:\inetpub\ftproot
사이트 asd192.168.10.196, C:\inetpub\site-asd
사이트 qwe192.168.10.199, C:\inetpub\site-qwe

1. IIS와 FTP 역할 설치

Install-WindowsFeature `
 -Name Web-Server, Web-Mgmt-Tools, Web-CGI, Web-Ftp-Server, Web-Basic-Auth `
 -IncludeManagementTools

Get-WindowsFeature Web-Server, Web-Mgmt-Tools, Web-CGI, Web-Ftp-Server

2. 서비스 상태 확인

Get-Service W3SVC, WAS, FTPSVC | Format-Table Name, Status, StartType

Start-Service W3SVC
Start-Service FTPSVC

Set-Service W3SVC -StartupType Automatic
Set-Service FTPSVC -StartupType Automatic

3. 방화벽 허용

GUI에서 Windows Defender Firewall 인바운드 규칙을 확인해도 되지만, 실습에서는 명령으로 확실히 남긴다.

New-NetFirewallRule `
 -DisplayName "IIS HTTP 80 Inbound" `
 -Direction Inbound `
 -Protocol TCP `
 -LocalPort 80 `
 -Action Allow

New-NetFirewallRule `
 -DisplayName "IIS FTP 21 Inbound" `
 -Direction Inbound `
 -Protocol TCP `
 -LocalPort 21 `
 -Action Allow

Get-NetFirewallRule -DisplayName "IIS * Inbound" |
 Format-Table DisplayName, Enabled, Direction, Action

4. 기본 웹 사이트 확인

Import-Module WebAdministration

Get-Website
Get-Item IIS:\Sites\Default* | Format-List name, state, physicalPath, bindings

기본 페이지를 간단히 바꾸고 로컬에서 HTTP 응답을 확인한다.

Set-Content -Path C:\inetpub\wwwroot\index.html -Value "IIS default site OK"

Invoke-WebRequest http://localhost/ -UseBasicParsing |
 Select-Object StatusCode, Content

5. FTP 루트와 사이트 생성

FTP는 반드시 인증과 권한을 명확히 해야 한다. 익명 쓰기 허용은 실습에서도 피하는 편이 좋다.

New-Item -ItemType Directory -Force -Path C:\inetpub\ftproot
Set-Content -Path C:\inetpub\ftproot\readme.txt -Value "FTP upload test root"

Import-Module WebAdministration

New-WebFtpSite `
 -Name "LabFTP" `
 -Port 21 `
 -PhysicalPath "C:\inetpub\ftproot" `
 -Force

Get-Website | Format-Table Name, State, PhysicalPath, Bindings

FTP 인증과 권한은 IIS Manager에서 설정해도 되지만, 적용 후에는 접근 권한과 Windows 계정 권한을 함께 확인해야 한다.

icacls C:\inetpub\ftproot
Get-LocalUser
Get-LocalGroupMember "Users"

6. IP 주소 추가

예시처럼 같은 서버에 두 번째 IP를 추가해 IP별로 다른 사이트를 붙일 수 있다. 실제 인터페이스 이름은 서버에서 확인한 값으로 바꾼다.

Get-NetAdapter
Get-NetIPAddress -AddressFamily IPv4

New-NetIPAddress `
 -InterfaceAlias "Ethernet" `
 -IPAddress 192.168.10.196 `
 -PrefixLength 24

Get-NetIPAddress -InterfaceAlias "Ethernet" -AddressFamily IPv4

7. IP 기반 웹 사이트 생성

New-Item -ItemType Directory -Force -Path C:\inetpub\site-asd
New-Item -ItemType Directory -Force -Path C:\inetpub\site-qwe

Set-Content -Path C:\inetpub\site-asd\index.html -Value "hi from asd"
Set-Content -Path C:\inetpub\site-qwe\index.html -Value "bye from qwe"

New-Website `
 -Name "site-asd" `
 -IPAddress "192.168.10.196" `
 -Port 80 `
 -PhysicalPath "C:\inetpub\site-asd"

New-Website `
 -Name "site-qwe" `
 -IPAddress "192.168.10.199" `
 -Port 80 `
 -PhysicalPath "C:\inetpub\site-qwe"

Get-Website | Format-Table Name, State, PhysicalPath, Bindings

8. 접속 테스트

Invoke-WebRequest http://192.168.10.196/ -UseBasicParsing |
 Select-Object StatusCode, Content

Invoke-WebRequest http://192.168.10.199/ -UseBasicParsing |
 Select-Object StatusCode, Content

다른 PC에서 테스트할 때는 routing, Windows firewall, DNS A record가 맞는지 같이 확인한다.

Test-NetConnection 192.168.10.196 -Port 80
Test-NetConnection 192.168.10.199 -Port 80
Resolve-DnsName www.st12.asd
Resolve-DnsName www.st12.qwe

9. 로그 확인

IIS 접속 로그는 기본적으로 C:\inetpub\logs\LogFiles 아래에 쌓인다. 사이트가 응답하지 않거나 403/404가 나오면 로그를 먼저 본다.

Get-ChildItem C:\inetpub\logs\LogFiles -Recurse |
 Sort-Object LastWriteTime -Descending |
 Select-Object -First 10 FullName, LastWriteTime, Length

정리

IIS 설치 실습은 역할 설치에서 끝나면 안 된다. W3SVC 서비스, 방화벽, site binding, physical path, NTFS 권한, HTTP 응답, 로그까지 확인해야 한다. FTP는 특히 익명 접근과 쓰기 권한을 조심해야 하며, IP 기반 사이트는 서버 NIC에 실제 IP가 붙어 있는지와 IIS binding이 정확한지 함께 봐야 한다.

문서 링크

BGM EVER