Nginx is an open-source software with various use cases some of which include Web Serving, Reverse Proxying, Load Balancing, Caching, Streaming, and more.
This is going to be a very short article walking you through the installation and setup of Nginx on your Windows device in a few steps.
Step 1: Download
Download Nginx (preferably the Mainline version) from the official download page by clicking on nginx/Windows-<version number>
.
A .zip file should immediately begin downloading.
Step 2: Extract and Install
Extract the contents of the .zip file to your "C:\Program Files" folder and run the nginx.exe
file.
Step 3: Verify
To verify that Nginx has been installed successfully, open your browser and enter "localhost". You should see something similar to the screenshot below:
Known Issues
Nginx may fail to install for some reasons, a major one being that you already have IIS or a different service running on port 80 on your Windows device. To fix this, you can either stop the service or use Nginx on a different port. To use Nginx on a different port:
- Open the "conf" folder in your Nginx root folder.
- Open
nginx.conf
in your preferred text editor. - Under the server section, change the listen port from 80 to 70 or any other preferred port number as shown below:
Now, you should be able to install Nginx. Verify the installation by opening localhost:70
on your browser.
Troubleshooting
To fix any other issues that might come up during the installation of Nginx, Nginx logs will come in handy. To access the logs:
- Open the "logs" folder in your Nginx root folder.
- Open the
error.txt
file in your favorite text editor. You should see something similar to the screenshot below: - Copy the error message, paste it on your favorite search engine and attach "nginx" and you should most likely get a solution.
Stopping Nginx
To stop Nginx, launch your task manager, right-click on "nginx" and end the task.
Conclusion
If you're here then I'm guessing you've successfully installed and set up Nginx on your Windows device. Congratulations!๐๐ฅณ
I'd love to hear how you intend on using Nginx, whether for load balancing, reverse proxying, caching or whatever so tweet at me or send a message on Linkedin.
Also, watch out for my next article where I'll be implementing load balancing on the API from my previous article.
Cheers!