IIS هو خادم الويب من مايكروسوفت — مدمج في كل SKU من Windows Server، متكامل مع مصادقة Windows و AD، والإجابة الصحيحة لاستضافة تطبيقات .NET. هذا الدليل يثبته، ينشئ موقعًا ثابتًا، ويضيف ربط HTTPS بشهادة Let's Encrypt عبر win-acme.
المتطلبات المسبقة
- Windows Server 2019/2022 مع PowerShell كمسؤول.
- سجل DNS يشير إلى الخادم.
الخطوة 1: ثبّت دور IIS
Install-WindowsFeature -Name Web-Server, Web-Common-Http, Web-Static-Content, `
Web-Default-Doc, Web-Http-Logging, Web-Mgmt-Console `
-IncludeManagementTools
لتطبيقات .NET:
Install-WindowsFeature -Name Web-Asp-Net45, Web-Net-Ext45, Web-ISAPI-Ext, Web-ISAPI-Filter
الخطوة 2: تحقق
Get-Service W3SVC, WAS
Invoke-WebRequest http://localhost/ -UseBasicParsing | Select-Object StatusCode
الخطوة 3: إنشاء موقع
New-Item -Path "D:\Sites\example.sa" -ItemType Directory -Force
Set-Content -Path "D:\Sites\example.sa\index.html" `
-Value '<h1>Hello from SKYLINE</h1>'
Import-Module WebAdministration
New-WebAppPool -Name "example.sa"
New-Website -Name "example.sa" `
-HostHeader "example.sa" `
-PhysicalPath "D:\Sites\example.sa" `
-ApplicationPool "example.sa" `
-Port 80
الخطوة 4: افتح جدار الحماية
Get-NetFirewallRule -DisplayGroup "World Wide Web Services (HTTP)" | Enable-NetFirewallRule
Get-NetFirewallRule -DisplayGroup "Secure World Wide Web Services (HTTPS)" | Enable-NetFirewallRule
الخطوة 5: TLS مع win-acme
$ver = "v2.2.9.1701"
Invoke-WebRequest "https://github.com/win-acme/win-acme/releases/download/$ver/win-acme.$ver.x64.trimmed.zip" `
-OutFile "$env:TEMP\wacs.zip"
Expand-Archive "$env:TEMP\wacs.zip" -DestinationPath "C:\Tools\win-acme" -Force
cd C:\Tools\win-acme
.\wacs.exe
الخطوة 6: شدّ الإعدادات
Set-WebConfigurationProperty -Filter "/system.webServer/directoryBrowse" `
-Name "enabled" -Value "false" -PSPath "IIS:\Sites\example.sa"
Set-WebConfigurationProperty -Filter "/system.webServer/security/requestFiltering" `
-Name "removeServerHeader" -Value "True" `
-PSPath "IIS:\Sites\example.sa"
التحقق
Invoke-WebRequest "https://example.sa/" -UseBasicParsing
Get-WebBinding | Format-Table
Get-Website | Format-Table Name, State, PhysicalPath
الخاتمة
IIS مناسب للمواقع الثابتة و تطبيقات .NET وبوابات الإنترانت. لأحمال إنتاج غير .NET، استخدمه كوكيل عكسي عبر ARR.
Comments
0 total · 0 threads