Host a Node.js /w Next.js Application
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
Running a Next.js app on a Windows Server with IIS (Internet Information Services) so it's publicly accessible requires a few steps, since IIS is not built to directly run Node.js apps. But you can do it by using a reverse proxy to forward IIS requests to your Next.js app running on a local port.
Go to https://nodejs.org/ and download the LTS version.
Install it and verify with:
node -v
npm -v
Copy your app to the Windows Server.
Navigate to the app folder and run:
npm install
npm run build
npm run start
This starts your app, likely on http://localhost:3000
.
If needed, you can configure it to use a different port (e.g., 5000) by setting the PORT
environment variable:
set PORT=5000 && npm run start
To make the app accessible via IIS:
URL Rewrite Module
ARR
Open IIS Manager
Click on the server name (root node)
Open Application Request Routing Cache
On the right-hand side, click "Server Proxy Settings"
Check "Enable proxy" and click Apply
Point the site root to any folder (even if empty—it won’t serve files directly).
Assign a host name (e.g., myapp.mydomain.com
) or use a port binding.
Select the website in IIS
Open URL Rewrite
Click "Add Rules" → Choose "Reverse Proxy"
Set the destination as:
http://localhost:3000
(or whatever port your Next.js app is running on)
IIS won’t run the Node app directly, so use one of these tools:
PM2 (recommended for production):
npm install pm2 -g
pm2 start npm --name "nextjs-app" -- run start
pm2 save
pm2 startup
NSSM (Non-Sucking Service Manager) to run it as a Windows Service
Make sure your domain (e.g., myapp.mydomain.com
) points to your Windows server’s IP.
Open a browser and visit the domain — you should see your Next.js app!
Make sure ports 80/443 are open in the firewall.
You can also configure HTTPS using a certificate in IIS.