Skip to content

Nginx on Windows Server: install, test and run it as a service

Verified 1 min read

Unpack Nginx on Windows, test the config from the right directory, run it on 8081, and wrap it as a service without pretending it is Linux Nginx.

Tested onStandard / Datacenter · Build 26100.33650 · x64
E1
Build
26100.33650
Edition
Standard / Datacenter
Architecture
x64
Support
Documentation (E1)
Evidence
E1Official documentation
Verified
2026-10-29
Test machine
Nginx 1.28.0 on VM 361 Windows 11 26H2, port 8081; Server 2025 service wrapping E1
Page type
Setup
Welcome to nginx page served from Nginx 1.28.0 on Windows 11 26H2, port 8081.
VM 361: Nginx 1.28.0 unpacked at C:\nginx, default page on http://localhost:8081. Windows 11 UI; Server 2025 service setup is E1.

Nginx on Windows is a console application, not a Windows service by default:

Terminal window
cd C:\nginx
nginx.exe -t
start nginx
nginx.exe -s reload
nginx.exe -s stop

The official Windows build is useful for a lab, an internal site or a compatibility tier. It is not feature-equivalent to Linux Nginx: no php-fpm, no HTTP/3 module, and fewer tuning options. Do not present it as a high-concurrency production edge.

  1. Download the Windows zip from nginx.org.
  2. Extract to C:\nginx (avoid Program Files spaces and ACL surprises).
  3. Edit conf/nginx.conf; start with listen 8081; if IIS already owns 80.
  4. Run nginx -t from C:\nginx, then start nginx.
  5. Open the firewall only for the lab network.

The lab used:

C:\nginx\nginx.exe -v -> nginx/1.28.0
listen 8081
http://localhost:8081/ -> 200 "Welcome to nginx!"

Why nginx -t fails from the wrong directory

Section titled “Why nginx -t fails from the wrong directory”

Nginx resolves conf/nginx.conf, logs/error.log and relative root paths against its working directory. Running it from C:\Windows\System32 produces:

CreateFile() "C:\WINDOWS\system32/conf/nginx.conf" failed

That is not a broken install. cd C:\nginx first, or use absolute paths in the config/service wrapper.

Use a wrapper such as WinSW or NSSM. Minimal WinSW intent:

  • executable: C:\nginx\nginx.exe
  • working directory: C:\nginx
  • stop: nginx.exe -s stop (or wrapper’s stop command)
  • account: a dedicated low-privilege account with read on C:\nginx, write on logs and temp
  • startup: automatic, restart on failure

Do not run it as LocalSystem just because the service starts. Nginx only needs its own directories.

Topic Windows Nginx
php-fpm Not available; use PHP-CGI/FastCGI
HTTP/3 ngx_http_v3_module cannot be built on Win32
Performance Not Linux-equivalent; test before claiming numbers
Service Wrapper required
Signals nginx -s reload/stop, not Unix signals
Terminal window
cd C:\nginx
.\nginx.exe -t
Get-Process nginx
Invoke-WebRequest http://localhost:8081/ -UseBasicParsing | Select-Object StatusCode
Get-Content .\logs\error.log -Tail 20

Nginx 1.28.0 was unpacked and served on 8081 on Windows 11 26H2. Server 2025 role/firewall/service wrapping remains E1; no performance or HTTP/3 claim is made.

Sources