Home Cloud Serevrs Set Up an Nginx Web Server on a Windows VPS

Set Up an Nginx Web Server on a Windows VPS

Last updated on Feb 13, 2025

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

  1. Download the latest Nginx for Windows from:
    👉 https://nginx.org/en/download.html

  2. Extract the ZIP file to C:\nginx.

  3. Open Command Prompt (Admin) and navigate to the Nginx folder:

    cd C:\nginx
    
    
  4. Start Nginx:

    start nginx
    
    
  5. 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

  1. Open Windows Defender Firewall (Win + R, type wf.msc, press Enter).

  2. Click Advanced SettingsInbound RulesNew Rule.

  3. Select Port, then click Next.

  4. Choose TCP, enter 80, 443, then click Next.

  5. Select Allow the connection, then click Next again.

  6. Apply to Domain, Private, and Public networks.

  7. Name the rule Nginx Web Server and click Finish.

Your Nginx server can now receive external requests!


3️⃣ Configure Nginx Server Blocks (Virtual Hosts)

  1. Open File Explorer and navigate to:

    C:\nginx\conf
    
    
  2. Open nginx.conf in Notepad or Notepad++.

  3. 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;
        }
    }
    
    
  4. Save the file and restart Nginx:

    nginx -s reload
    
    
  5. 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

  1. Download Certbot for Windows from:
    👉 https://certbot.eff.org/instructions

  2. Install it on your VPS.

Step 2: Generate an SSL Certificate

  1. Open Command Prompt (Admin) and run:

    certbot certonly --standalone -d yourdomain.com
    
    
  2. Follow the instructions and verify your domain.

Step 3: Configure Nginx for HTTPS

  1. Open nginx.conf and modify the server 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;
        }
    }
    
    
  2. Restart Nginx:

    nginx -s reload
    
    

Your website now runs over HTTPS!


5️⃣ Automate Nginx Startup (Optional)

To start Nginx automatically when Windows boots:

  1. Open Task Scheduler (Win + R, type taskschd.msc, press Enter).

  2. Click Create Basic Task (right panel).

  3. Name it Start Nginx Server → Click Next.

  4. Select When the computer starts → Click Next.

  5. Select Start a program → Click Next.

  6. Browse to C:\nginx\nginx.exe.

  7. 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.