7.2 KiB
7.2 KiB
IIS Server-ல் Node.js App Host செய்வது - Step by Step Guide
Prerequisites (முன் தேவைகள்)
-
Node.js Installation
- Node.js 18.x அல்லது அதற்கு மேல் install செய்ய வேண்டும்
- Download: https://nodejs.org/
- Installation பிறகு, Command Prompt-ல்
node --versionrun செய்து verify செய்யவும்
-
iisnode Module Installation
- Download: https://github.com/Azure/iisnode/releases
- Latest version-ஐ download செய்து install செய்யவும்
- Install பிறகு IIS-ஐ restart செய்யவும்
-
IIS Features Enable செய்யவும்
- Windows Features-ல் இவை enable செய்யவும்:
- Internet Information Services (IIS)
- IIS Management Console
- URL Rewrite Module (https://www.iis.net/downloads/microsoft/url-rewrite)
- Application Request Routing (ARR) - Optional
- Windows Features-ல் இவை enable செய்யவும்:
Step 1: Project Build செய்யவும்
# Project root directory-ல்
npm install
npm run build
Step 2: IIS-ல் Website Create செய்யவும்
Method 1: IIS Manager-ல் Manual Setup
- IIS Manager open செய்யவும்
- Connections pane-ல் server name-ஐ right-click செய்து Add Website select செய்யவும்
- Fill செய்யவும்:
- Site name:
PozoApp(அல்லது உங்கள் விருப்பத்திற்கு) - Application pool: New application pool create செய்யவும்
- Physical path:
D:\2025\Pozo Dev\PozoDev Updated OptimandSEO\Nov 7\dist - Binding:
- Type:
http - IP address:
All Unassigned(அல்லது specific IP) - Port:
80(அல்லது வேறு port) - Host name: (optional)
pozo.appஅல்லதுwww.pozo.app
- Type:
- Site name:
- OK click செய்யவும்
Method 2: PowerShell-ல் Script
# Run as Administrator
Import-Module WebAdministration
$siteName = "PozoApp"
$physicalPath = "D:\2025\Pozo Dev\PozoDev Updated OptimandSEO\Nov 7\dist"
$port = 80
# Create Application Pool
New-WebAppPool -Name $siteName
Set-ItemProperty IIS:\AppPools\$siteName -Name managedRuntimeVersion -Value ""
# Create Website
New-Website -Name $siteName -PhysicalPath $physicalPath -Port $port -ApplicationPool $siteName
Step 3: Application Pool Configuration
- IIS Manager-ல் Application Pools select செய்யவும்
- உங்கள் application pool-ஐ select செய்யவும்
- Advanced Settings open செய்யவும்
- இவை set செய்யவும்:
- .NET CLR Version:
No Managed Code - Enable 32-Bit Applications:
False(64-bit Node.js-க்கு) - Start Mode:
AlwaysRunning(optional, auto-start-க்கு) - Idle Timeout:
0(idle-ல stop ஆகாமல்)
- .NET CLR Version:
Step 4: Environment Variables Setup (Optional)
Application Pool-க்கு environment variables set செய்யலாம்:
# Run as Administrator
$appPoolName = "PozoApp"
$env = Get-ItemProperty "IIS:\AppPools\$appPoolName" -Name environmentVariables
$env.Add("NODE_ENV", "production")
$env.Add("PORT", "process.env.PORT")
$env.Add("API_URL", "https://api.pozo.app")
$env.Add("PRODUCTION_URL", "https://www.pozo.app")
Set-ItemProperty "IIS:\AppPools\$appPoolName" -Name environmentVariables -Value $env
Step 5: Permissions Setup
dist folder-க்கு IIS application pool identity-க்கு permissions கொடுக்கவும்:
# Run as Administrator
$folderPath = "D:\2025\Pozo Dev\PozoDev Updated OptimandSEO\Nov 7\dist"
$appPoolName = "PozoApp"
$identity = "IIS AppPool\$appPoolName"
# Full control permissions
icacls $folderPath /grant "${identity}:(OI)(CI)F" /T
Step 6: Verify web.config
dist folder-ல் web.config file உள்ளதா check செய்யவும். இது already configure செய்யப்பட்டிருக்கும்.
Step 7: Test the Application
- IIS Manager-ல் website-ஐ Start செய்யவும்
- Browser-ல் open செய்யவும்:
http://localhost(port 80-க்கு)- அல்லது
http://localhost:PORT(custom port-க்கு)
Troubleshooting (பிரச்சனைகள் தீர்த்தல்)
Error: "iisnode module not found"
- iisnode install செய்யப்பட்டதா verify செய்யவும்
- IIS-ஐ restart செய்யவும்
Error: "Cannot find module"
distfolder-ல்node_modulesfolder உள்ளதா check செய்யவும்- Project root-ல்
npm installrun செய்யவும் distfolder-க்குnode_modulescopy செய்யவும்:xcopy /E /I /Y "node_modules" "dist\node_modules"
Error: "Port already in use"
- IIS-ல் binding-ஐ check செய்யவும்
- வேறு port use செய்யவும்
Error: "500 Internal Server Error"
- IIS logs check செய்யவும்:
C:\inetpub\logs\LogFiles\ - iisnode logs check செய்யவும்:
dist\iisnode\folder - Application Pool-ல் Advanced Settings → Process Model → Identity-ஐ check செய்யவும்
Static Files Load ஆகாமல்
web.config-ல் static content rules சரியாக configure செய்யப்பட்டதா check செய்யவும்- IIS-ல் Static Content feature enable செய்யப்பட்டதா verify செய்யவும்
ES Modules Error
- Node.js version 18+ install செய்யப்பட்டதா verify செய்யவும்
package.json-ல்"type": "module"உள்ளதா check செய்யவும்
Logs Check செய்யவும்
- IIS Logs:
C:\inetpub\logs\LogFiles\W3SVC[SiteID]\ - iisnode Logs:
dist\iisnode\folder - Application Logs: Event Viewer → Windows Logs → Application
Production Deployment Tips
- HTTPS Setup: SSL certificate install செய்து HTTPS enable செய்யவும்
- Firewall: Port 80/443 open செய்யவும்
- Domain: DNS-ல் domain point செய்யவும்
- Monitoring: Application performance monitor செய்யவும்
- Backup: Regular backup எடுக்கவும்
Quick Commands
# Website start
Start-Website -Name "PozoApp"
# Website stop
Stop-Website -Name "PozoApp"
# Application Pool restart
Restart-WebAppPool -Name "PozoApp"
# Check website status
Get-Website -Name "PozoApp"
# View application pool status
Get-WebAppPoolState -Name "PozoApp"
Support
பிரச்சனைகள் இருந்தால்:
- IIS logs check செய்யவும்
- iisnode logs check செய்யவும்
- Node.js version verify செய்யவும்
- Permissions verify செய்யவும்