วิธีติดตั้ง IIS บน Windows Server 2022 Server Core แบบไม่มี GUI

 Windows Server 2022 Server Core เป็นรูปแบบการติดตั้งที่ไม่มี Desktop Experience หรือ GUI ทำให้ใช้ทรัพยากรน้อยกว่า มีความปลอดภัยสูงกว่า และลดภาระในการอัปเดตระบบ ผู้ดูแลระบบระดับ Enterprise จำนวนมากจึงเลือกใช้ Server Core สำหรับงาน Web Server

แม้จะไม่มีหน้าจอ IIS Manager เหมือน Windows Server 2022 แบบ Desktop Experience แต่ก็สามารถติดตั้งและบริหารจัดการ IIS ได้อย่างสมบูรณ์ผ่าน PowerShell และ Remote Management

บทความนี้จะสอนวิธีติดตั้ง IIS บน Windows Server 2022 Server Core แบบละเอียด ตั้งแต่เริ่มต้นจนพร้อมเปิดเว็บไซต์จริง


🌐 Windows Server 2022 Server Core คืออะไร

Server Core คือโหมดการติดตั้ง Windows Server ที่ไม่มี GUI

ประกอบด้วย

✅ Command Prompt

✅ PowerShell

✅ Windows Services

✅ Roles และ Features

ไม่มี

❌ Desktop

❌ File Explorer

❌ Server Manager

❌ IIS Manager

Microsoft แนะนำให้ใช้ Server Core สำหรับ Production Server ที่ต้องการความเสถียรและความปลอดภัยสูง


🚀 ข้อดีของการใช้ IIS บน Server Core

✅ ใช้ RAM น้อยกว่า

Server Core ใช้ทรัพยากรต่ำกว่า Desktop Experience


✅ ปลอดภัยกว่า

ลดจำนวน Component ที่อาจมีช่องโหว่


✅ อัปเดตน้อยกว่า

Patch และ Security Update มีจำนวนน้อยลง


✅ ลด Downtime

ลดจำนวนครั้งที่ต้อง Restart หลังอัปเดต


✅ เหมาะกับ Data Center

นิยมใช้ใน

  • Cloud Infrastructure

  • Hosting Provider

  • Enterprise Environment


🔍 ตรวจสอบเวอร์ชัน Server

เปิด PowerShell

รัน

Get-ComputerInfo

หรือ

systeminfo

เพื่อตรวจสอบว่าเป็น Windows Server 2022


🔍 ตรวจสอบว่า IIS ติดตั้งแล้วหรือยัง

รัน

Get-WindowsFeature Web-Server

หากขึ้น

Installed : False

แสดงว่ายังไม่ได้ติดตั้ง


🚀 ติดตั้ง IIS พื้นฐาน

รัน

Install-WindowsFeature Web-Server

รอจนติดตั้งเสร็จ


🚀 ติดตั้ง IIS พร้อมเครื่องมือบริหารจัดการ

แม้ Server Core จะไม่มี GUI แต่ควรติดตั้ง Management Components ไว้

Install-WindowsFeature Web-Server -IncludeManagementTools

🚀 ติดตั้ง IIS สำหรับ Production Website

แนะนำให้ติดตั้ง Role Services เพิ่มเติม

Install-WindowsFeature `
Web-Server,
Web-Default-Doc,
Web-Static-Content,
Web-Http-Errors,
Web-Http-Logging,
Web-Request-Monitor,
Web-Filtering,
Web-Stat-Compression,
Web-Mgmt-Service

🚀 ติดตั้ง ASP.NET บน Server Core

สำหรับเว็บไซต์ ASP.NET

Install-WindowsFeature `
Web-Asp-Net45,
Web-Net-Ext45,
Web-ISAPI-Ext,
Web-ISAPI-Filter

🔍 ตรวจสอบผลการติดตั้ง

รัน

Get-WindowsFeature Web-*

Role ที่ติดตั้งแล้วจะมีเครื่องหมาย

[X]

⚡ เริ่มต้น IIS Service

รัน

Start-Service W3SVC

ตรวจสอบสถานะ

Get-Service W3SVC

ผลลัพธ์ควรเป็น

Running

⚡ ตั้งค่าให้เริ่มทำงานอัตโนมัติ

Set-Service W3SVC -StartupType Automatic

🌍 ทดสอบเว็บไซต์แรก

สร้างโฟลเดอร์

New-Item -Path C:\inetpub\wwwroot -ItemType Directory -Force

สร้างไฟล์

Set-Content `
-Path C:\inetpub\wwwroot\index.html `
-Value "<h1>Hello Windows Server 2022 Server Core</h1>"

🌍 ทดสอบผ่าน Browser

บน Server

รัน

Invoke-WebRequest http://localhost

หากแสดง HTML กลับมา

แสดงว่าเว็บไซต์ทำงานแล้ว


🔒 เปิด Firewall สำหรับ Web Server

เปิด HTTP

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

เปิด HTTPS

New-NetFirewallRule `
-DisplayName "HTTPS" `
-Direction Inbound `
-Protocol TCP `
-LocalPort 443 `
-Action Allow

🖥️ วิธีจัดการ IIS จากเครื่องอื่น

Server Core ไม่มี IIS Manager

จึงนิยมใช้

วิธีที่ 1

Remote IIS Manager

จาก Windows 10 หรือ Windows 11


วิธีที่ 2

Windows Admin Center


วิธีที่ 3

PowerShell Remoting

Enter-PSSession SERVER01

⚡ เปิด IIS Remote Management

ติดตั้ง

Install-WindowsFeature Web-Mgmt-Service

เปิด Service

Start-Service WMSVC

ตั้งค่า Auto Start

Set-Service WMSVC -StartupType Automatic

🔍 ตรวจสอบ IIS Version

รัน

Get-ItemProperty `
"HKLM:\SOFTWARE\Microsoft\InetStp"

ผลลัพธ์

MajorVersion : 10

หมายถึง IIS 10


🚨 ปัญหาที่พบบ่อย

Website เปิดไม่ได้

ตรวจสอบ

Get-Service W3SVC

Port 80 ถูกใช้งาน

netstat -ano

Firewall Block

ตรวจสอบ Rule

Get-NetFirewallRule

💡 Best Practices สำหรับ Production

เมื่อใช้ IIS บน Windows Server 2022 Server Core

ควร

① ใช้ HTTPS ทุกเว็บไซต์

② เปิดเฉพาะ Role Services ที่จำเป็น

③ เปิด Logging

④ แยก Application Pool

⑤ ใช้ PowerShell Script เป็นมาตรฐาน

⑥ ใช้ Windows Admin Center ในการบริหาร

ทีมงาน comsiam พบว่า Server Core สามารถลดพื้นที่โจมตีของระบบได้อย่างมีนัยสำคัญเมื่อเทียบกับ Desktop Experience

สำหรับองค์กรขนาดใหญ่ comsiam แนะนำให้ใช้ Server Core เป็นมาตรฐานสำหรับ Web Server ใหม่ทั้งหมด เพราะช่วยลดภาระการดูแลรักษาในระยะยาวได้อย่างมาก


🎯 สรุป

การติดตั้ง IIS บน Windows Server 2022 Server Core สามารถทำได้ทั้งหมดผ่าน PowerShell โดยไม่จำเป็นต้องมี GUI ช่วยให้ Server มีความปลอดภัยสูง ใช้ทรัพยากรน้อย และเหมาะสำหรับงาน Production ระดับ Enterprise

คำสั่งที่นิยมใช้มากที่สุดคือ

Install-WindowsFeature Web-Server -IncludeManagementTools

จากนั้นเปิด W3SVC และ Firewall ก็พร้อมใช้งาน Web Server บน Server Core ได้ทันที

Popular posts from this blog

Windows Server 2022 ยังน่าใช้ในปีนี้หรือไม่? คำตอบสำหรับคนกำลังวางระบบใหม่

สเปกเครื่องสำหรับติดตั้ง Windows Server 2022 เลือกอย่างไรให้คุ้มและใช้งานได้ยาว

Windows Server 2022 คืออะไร? คู่มือสำหรับมือใหม่