Windows Server 2008 內建 IIS 7,模組化架構、整合管線、強化安全性。本文透過「伺服器管理員」加入 Web 伺服器 (IIS) 角色,並說明常用角色服務選擇、網站建立、應用程式集區設定與 SSL 憑證綁定。
MySiteC:\inetpub\wwwroot\MySite (預先建立資料夾並放入網頁檔案)MySite (自動建立同名集區) →「進階設定」。ApplicationPoolIdentity (預設、安全) 或自訂網域帳號 (需存取網路資源時)# 匯入 WebAdministration 模組
Import-Module WebAdministration
# 新增網站
New-Website -Name "MySite" -Port 80 -PhysicalPath "C:\inetpub\wwwroot\MySite"
# 設定應用程式集區 .NET 版本
Set-ItemProperty "IIS:\AppPools\MySite" -Name managedRuntimeVersion -Value "v4.0"
# 匯入並繫結 SSL 憑證 (需 .pfx 檔與密碼)
$cert = Import-PfxCertificate -FilePath "C:\certs\mysite.pfx" -CertStoreLocation Cert:\LocalMachine\My -Password (ConvertTo-SecureString "pwd" -AsPlainText -Force)
New-WebBinding -Name "MySite" -Protocol https -Port 443 -SslFlags 1
# 繫結需透過 netsh 或 appcmd 完成
appcmd set site /site.name:"MySite" /+bindings.[protocol='https',bindingInformation='*:443:']
appcmd set site /site.name:"MySite" /bindings.[protocol='https',bindingInformation='*:443:'].sslFlags:"Sni"
| 現象 | 檢查項目 |
|---|---|
| HTTP 500.19 內部伺服器錯誤 | web.config 格式錯誤、模組未安裝 (如 URL Rewrite)、權限不足 |
| HTTP 401.3 未授權 | NTFS 權限缺少 IUSR/ApplicationPoolIdentity 讀取權限 |
| HTTPS 憑證錯誤 | 憑證 CN 不符網域、信任鏈缺失、過期、私鑰不可匯出 |
| 靜態檔案 404 | 靜態內容模組未安裝、MIME 對應缺失、路徑大小寫 (Linux 移植) |
完成上述步驟,Windows Server 2008 IIS 7 即可穩定提供網站服務,支援 ASP.NET、PHP、靜態內容與安全 HTTPS 部署。
Windows Server 2008 全面稽核策略建置指南:從合規到安全防禦
免光碟硬碟安裝 Windows Server 2008 圖文教學:從 ISO 解壓到 setup.exe 執行
Windows Server 2008 內建備份新功能深度解析:區塊級、磁碟卷影、增量、DVD/網路備份、Windows Server Backup 安裝
微軟公布 Windows 7 與 Windows Server 2008 R2 同步上市時程表
Windows Server 2008 HPC 叢集核心概念與使用者角色管理完整指南
解決 Windows Server 2008 網路芳鄰開啟緩慢問題