Nginx Windows: How to InstallWeb Servers
Updated on Friday, August 30, 2013
Updated on Friday, August 30, 2013
If you’d like to try this tutorial on our public cloud, we’re currently offering a free $10.00 credit for signing up. You’ll be able to start up a cloud server, create virtual networks, use load balancers and more within seconds after you sign up on our OpenStack® public cloud.
Nginx is an extremely high performance web server which has the ability to handle thousands of requests per second with little hardware requirements. It can be installed on any operating system and it comes as an open source application as well.
As much as Nginx is setup and supported for Windows, it does come with quite a few issues which limit it’s performance. We strongly recommend that you setup Nginx on a Linux server. You can get started on our cloud servers for just a few dollars per month.
We’re going to go over how to install Nginx for Windows and we will also cover the details of how to set it up as a service within Windows, so it can start automatically.. You will need to have full Administrator access to the machine that you will be setting up as well to continue.
Nginx comes pre-compiled for Windows which makes it extremely easy to get started. If it did not come pre-compiled, you would need to have a compiler installed on your computer with a full environment. Fortunately, this is not the case. At the time of this article, the latest Nginx version is 1.5.4 so we’ll download it from here:
Once you’ve downloaded Nginx for Windows, you can extract it to your folder of choice, we recommend that you install it somewhere easily accessible such as
In order to make sure that the service is working with no problems, we recommend that you start a command prompt window and type the following, make sure that you update the path if you’ve installed it in another folder.
You should be able to go to
http://localhost/ and you should see the “Welcome to Nginx” default page. If you see that page, then we can be sure that Nginx has been installed properly. We will now shut it down and install it as a service, to stop it, you can use this command.
C:/nginx/nginx.exe -s stop
Now, if you were using Nginx as a simple development server, you can use these simple commands to start and stop the server as you need. However, if you will be using it as a production server, you would want to install it as a Windows service, which is what we’re covering in the next step.
We will be using the WINSW project to create a service out of the existing Nginx binaries. The first step is to download it from the following URL and save it in the same folder as Nginx as
Once that is setup, you will need to create a service file, please be sure to create a file with the name
nginxsvc.xml and with the following contents:
<service> <id>nginx</id> <name>nginx</name> <description>nginx</description> <executable>c:nginxnginx.exe</executable> <logpath>c:nginx</logpath> <logmode>roll</logmode> <depend></depend> <startargument>-p c:nginx</startargument> <stopargument>-p c:nginx -s stop</stopargument> </service>
You are now ready to install the Windows service, you can proceed to run the following command:
You can now proceed to manage the service from your service manager. The easiest and fastest way to access it is to type the following in your command prompt:
You should be all setup and done at this point. You have Nginx as a service and you can set it up to start automatically when it is booted with your operating system!