Table of Contents
Download Nginx and NSSM
Nginx is an free, open-source HTTP server characterized by its small footprint, exceptional performance and efficient use of resources. It hosts over 7% of all domains worldwide!
Non-Sucking Service Manager (NSSM) is a service helper program that assists in installing an application as a service, monitoring the application’s state and handling failures as it runs.
1. To run Nginx as a Windows Service you need download:
- Nginx for Windows: http://nginx.org/en/download.html
- Download NSSM: https://nssm.cc/download
2. Extract downloaded files then copy nssm.exe in win64 folder and src folder to extracted nginx folder.
3. Now, in the nginx folder, we have nginx source and nssm source.
4. Copy all files and folders in nginx folder to C:/nginx ( create nginx folder in C drive if it not exists).
5. Right click on the Start icon then open Windows PowerShell as administrator.
6. Navigate to nginx folder then run this command .\nssm.exe install to open NSSM service installer.
PS C:\Users\mpnadmin> cd /
PS C:\> cd .\nginx\
PS C:\nginx> .\nssm.exe install
Service "Nginx" installed successfully!
7. In the NSSM service installer window:
- Application Path: Browse to nginx.exe in C:\nginx.
- Service name: Enter service name as you need.
- Click button.
8. Now, open Windows Services (services.msc) then start the Nginx service. As you can see, Startup Type is Automatic, it means nginx service will load on boot.
Finally, open any web browser then visit localhost to verify it works.
Not a reader? Watch this related video tutorial: