Random Stuff of Randomness

Simon's

Install Nginx on Windows

nginx (pronounced engine x) is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server, originally written by Igor Sysoev.

This article will show how do a minimal install on windows.

Prepare

check if process is running

First of all, makre sure it is not already installed and/or runing:

1PS C:\Users\user> tasklist /fi "imagename eq nginx.exe"
2INFO: No tasks are running which match the specified criteria.

Good, now make sure there is nothing listening on port 80:

check if port is free

1PS C:\Users\user> Get-NetTCPConnection -State Listen | `
2>>   Where-Object {$_.LocalPort -eq 80}
3PS C:\Users\user>

download

Official releases can be foudn here: https://nginx.org/en/download.html, get the Mainline version for windows.

After unzipping the archive, you will be presentend with a surprinsingly few files. Whereis the actual axecutable is a statically linked 3.7mb exe called nginx[.exe]:

file list

startting the service is simple, from the command line run nginx and point your browser to http://localhost. You should see a standard welcome page:

Welcome message from nginx

controlling the running process:

commanddescription
nginx -s stopfast shutdown
nginx -s quitgraceful shutdown
nginx -s reloadchanging configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes
nginx -s reopenre-opening log files
Note:
nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the select() and poll() (1.15.9) connection processing methods are currently used, so high performance and scalability should not be expected.