Nginx is a high-performance web server and reverse proxy that can handle static and dynamic content efficiently. Hosting Nginx on a Windows VPS allows you to run websites, APIs, and load balancing services.
This guide will walk you through installing, configuring, and securing an Nginx web server on a Windows Server VPS.
📌 Prerequisites
-
A Windows Server VPS (2016, 2019, or 2022) from VolticHost
-
Administrator access
-
Ports 80 (HTTP) and 443 (HTTPS) open in the firewall
-
A domain name (optional, but recommended)
1️⃣ Download and Install Nginx on Windows
-
Download the latest Nginx for Windows from:
👉 https://nginx.org/en/download.html -
Extract the ZIP file to
C:\nginx
. -
Open Command Prompt (Admin) and navigate to the Nginx folder:
cd C:\nginx
-
Start Nginx:
start nginx
-
Open a web browser and go to:
http://localhost
If installed correctly, you will see the Nginx Welcome Page.
✅ Nginx is now installed and running!
2️⃣ Configure Windows Firewall for Nginx
-
Open Windows Defender Firewall (
Win + R
, typewf.msc
, press Enter). -
Click Advanced Settings → Inbound Rules → New Rule.
-
Select Port, then click Next.
-
Choose TCP, enter 80, 443, then click Next.
-
Select Allow the connection, then click Next again.
-
Apply to Domain, Private, and Public networks.
-
Name the rule Nginx Web Server and click Finish.
✅ Your Nginx server can now receive external requests!
3️⃣ Configure Nginx Server Blocks (Virtual Hosts)
-
Open File Explorer and navigate to:
C:\nginx\conf
-
Open
nginx.conf
in Notepad or Notepad++. -
Scroll down and find the
server
block. Modify it as follows:server { listen 80; server_name yourdomain.com; location / { root C:/nginx/html; index index.html; } }
-
Save the file and restart Nginx:
nginx -s reload
-
Place your website files in
C:\nginx\html
.
✅ Your website is now live on your VPS!
4️⃣ Set Up SSL with Let's Encrypt (HTTPS)
To enable HTTPS, you need an SSL certificate.
Step 1: Download Certbot
-
Download Certbot for Windows from:
👉 https://certbot.eff.org/instructions -
Install it on your VPS.
Step 2: Generate an SSL Certificate
-
Open Command Prompt (Admin) and run:
certbot certonly --standalone -d yourdomain.com
-
Follow the instructions and verify your domain.
Step 3: Configure Nginx for HTTPS
-
Open
nginx.conf
and modify theserver
block:server { listen 80; listen 443 ssl; server_name yourdomain.com; ssl_certificate C:/Certbot/live/yourdomain.com/fullchain.pem; ssl_certificate_key C:/Certbot/live/yourdomain.com/privkey.pem; location / { root C:/nginx/html; index index.html; } }
-
Restart Nginx:
nginx -s reload
✅ Your website now runs over HTTPS!
5️⃣ Automate Nginx Startup (Optional)
To start Nginx automatically when Windows boots:
-
Open Task Scheduler (
Win + R
, typetaskschd.msc
, press Enter). -
Click Create Basic Task (right panel).
-
Name it Start Nginx Server → Click Next.
-
Select When the computer starts → Click Next.
-
Select Start a program → Click Next.
-
Browse to
C:\nginx\nginx.exe
. -
Click Finish.
✅ Nginx will now start automatically on reboot!
🎉 Conclusion
You've successfully set up an Nginx web server on a Windows VPS! Your website is now live, and you can host HTML, PHP, or API applications securely. 🚀
For more assistance, contact VolticHost Support.