How to install nginx windows

Как установить и запустить Nginx на Windows 10

В этой статье мы разберём, как установить Nginx на Windows 10 и запустить его, также эта инструкция подойдёт для Windows 7 и Windows 8.

Ещё перед этой статьи, прочитаете «Как установить Apache на Windows»,это если вам нужен будет Apache.

Скачать Nginx:

Перед тем как установить, нужно скачать Nginx, переходите по этой ссылки, там скачаете архив с ним.

Как видите я скачал стабильную версию, и вам тоже рекомендую так именно её, так как, основной могут быть баги.

После того как скачали, открываем архив и папку внутри, перемешаем в папку которую вам надо, но я рекомендую в «Program Files», иначе придётся ещё добавлять Nginx в директиву «path».

Установка и запуск Nginx:

После того, как вы переместили, заходите в папку и Nginx и запускаем файл «nginx.exe», по двойному клику левой кнопки мыши.

Тут стоит сказать, что при установки у вас не чего не появится и это может смутить, но чтобы убедится, видите в адресную строку браузера «http://localhost/», должно появится вот это.

Если у вас именно это, то значит всё работает так как надо.

Nginx запуск на Windows 10:

Единственное что стоит сказать, при перезагрузки компьютера или выключение и включение, сервер перестают работает, чтобы это исправить, есть два способа, первый через встроенный Windows server, но его я не буду, так как, он достаточно сложный и на мой взгляд не очень удобный, второй, это просто отправить на рабочий стол, в качестве ярлыка файл «nginx.exe».

Теперь вы можете спокойно запускать его с рабочего стола.

Настройка Nginx:

Последние что стоит рассказать, это то, как его настроить что бы было ещё удобрение, для этого заходим в папку со сервером и там переходим в «conf», и открываем файл «nginx.conf».

Единственное, что стоит в нём изменить, это грубо говоря массив «location», который указывает настройки для стартовой страницы сервера, надо изменить значение у ключа «root», в качестве значения используете путь до папки с вашим сайтом.

nginx под Windows

Версия nginx под Windows использует “родной” Win32 API (не эмуляцию Cygwin). В настоящий момент в качестве методов обработки соединений используются select() и poll() (1.15.9), поэтому не стоит ожидать высокой производительности и масштабируемости. В силу этого и ряда других известных проблем версия nginx под Windows рассматривается пока как бета-версия. На данный момент в ней доступна практически вся функциональность, что и в версии nginx под UNIX, за исключением XSLT-фильтра, фильтра изображений, модуля GeoIP и встроенного языка Perl.

Чтобы установить nginx/Windows, скачайте дистрибутив последней основной версии (1.19.10), поскольку основная ветвь nginx содержит все известные исправления. Затем распакуйте дистрибутив, перейдите в каталог nginx-1.19.10 и запустите nginx . Вот пример для корневого каталога на диске C:

Чтобы увидеть процессы nginx, запустите утилиту командной строки tasklist :

Один из процессов главный, другой — рабочий. Если nginx не запускается, нужно искать причину в в файле лога ошибок logs\error.log . Если же лог-файл не создался, то причину этого следует искать в Windows Event Log. Если вместо ожидаемой страницы выводится страница с ошибкой, нужно также искать причины ошибки в файле logs\error.log .

nginx/Windows использует каталог, в котором он был запущен, в качестве префикса для относительных путей в конфигурации. В вышеприведённом примере префиксом является C:\nginx-1.19.10\ . Пути в конфигурационном файле должны задаваться в UNIX-стиле с использованием прямых слэшей:

Читайте также:  Почему ноутбук сам обновляется до windows 10

nginx/Windows работает как стандартное консольное приложение (не сервис) и управляется при помощи следующих команд:

How to Install and Run the Nginx Server on Windows 10

Nginx is a web server that is very popular with Linux and BSD systems. Many assume it is not possible to install Nginx on Windows. That is not true at all because the web server can indeed be installed on Windows 10.

However, according to Nginx’s own website, there are a few performance limitations that have not been mitigated so far. These include only one worker (web application) running successfully, a lack of scalability and possible UDP authentication issues.

As of now, Nginx has mentioned that it will address all the problems in its future releases for Windows. To install and run Nginx successfully on Windows 10, follow the steps below.

Download the Nginx Server

There are many Windows download versions of Nginx, and Nginx recommends using the “mainline version.” However, you will not find any issues if you download its most recent stable version for Windows.

Select the latest zip file and download it to a new folder.

As a first step, you need to extract the new folder. You can use 7-zip, WinRAR or any other popular compression software.

After extracting the file contents in the original folder, you have to move the entire folder that came with the built-in download copy. We will have to move this to “Program Files.”

Paste the folder in the program files. We will run Nginx from this location as a default web service program.

Installing Nginx

To install and run Nginx, select and double-click the Nginx.exe file. It has now been activated for further use.

In the next step you need to verify if the installation has been successful. For this, you can go to your default browser and type “localhost.” If you see the following screen saying Nginx web server is successfully installed and working, there are no problems in your Windows 10 installation.

To stop Nginx, you can end it from the Task Manager window.

Running Nginx on Your Windows PC

To run Nginx, you have to use Internet Information Services (IIS), which is a Microsoft web server that serves requested HTML pages or files. You can enable it from “Turn Windows Features On or Off” on the Control Panel. Check the required fields for “Web Management Tools” and “IIS Management Console.”

It will take a while for IIS to be enabled on your computer as the changes are applied.

You can open IIS Manager directly from the Start menu. Here, you will be able to access the default website, which is is usually located at “inetpub wwwroot.” This is also known as the web application root.

It is helpful to change the physical path of this root to a more desirable folder. I created a new “Work” folder in C:\ and changed the physical path to “C:\Work.”

After this, go to the Nginx folder that you renamed in the Program files. Click “Conf” and select “nginx.conf.” This file can be edited using the Notepad++ text editor.

In Notepad++, change the root to the edited physical path which we discussed above.

You can edit the index.html file in the root folder in a separate tab. Change the text to what you want the web server to display on the screen.

Now, run the Nginx.exe program once again and type “localhost” on a browser window. The Nginx web server will highlight the edits you made.

Nginx resources site has a full list of web server applications which you can use to run various applications on Windows PC.

Читайте также:  Забыл пароль outlook windows что делать

Summary

Nginx is one of the leading web server companies which is expected to overshadow Apache in the future. Also, it is faster, can handle more concurrent issues and is reliable. To summarize, if you have a simple website you want to connect to Nginx, you can do it right now without any problems.

Have you tried installing and running Nginx on Windows systems? What were the issues you faced? Do let us know in the comments.

Sayak Boral is a technology writer with over ten years of experience working in different industries including semiconductors, IoT, enterprise IT, telecommunications OSS/BSS, and network security. He has been writing for MakeTechEasier on a wide range of technical topics including Windows, Android, Internet, Hardware Guides, Browsers, Software Tools, and Product Reviews.

8 comments

This is complete nonsense… All your doing is using Windows built-in IIS webserver and pointing it to the NGinx directory.. So IIS is service the content, NOT Nginx!

Thank you for your feedback.

It is true that IIS is in the background but Nginx is the one handling all the actual LIVE traffic based on the visible changes that you can see in nginx.conf files. For this, Nginx has to connect internally to IIS and then cache its response for any future requests. Imagine tens of thousands of your website users downloading an important pdf document from IIS at the same time, it can become painfully slow. Instead if you have a very powerful front-end server like Nginx handling the traffic, the request is processed faster.

Leave aside IIS, some actual popular websites use Ngnix as a front-ending server with Apache which is its biggest competitor. Why? Because, Nginx is generally faster than Apache.

No, No ,No. This is completely incorrect.

You cannot have two webservers binded on the same port and nothing in your article above suggests that IIS is running on a different port nor that nginx is making calls to it. Your nginx configuration file, as shown above, states that the nginx server process is listening on port 80 and serving the contents inside the root folder C:\Work, nothing more. So when you open the browser to localhost, it is nginx that is serving the html file directly from C:\Work. It is not ‘talking internally to IIS’ as you suggest.

Installing and running IIS is completely unnecessary in the scenario your article above describes. What you’re describing in your article and what you replied to Kelvin are two completely different use cases of nginx.

Thank you for sharing this update, I just want to known about logs how we can monitor load balancing via ngnix.

And same help me how setting up https .

Hi load balancing is a separate topic. Thanks for the suggestion.

Thank you for your immediate response, Could you please help me load balancing for 2 application server via nginx,

why not just use WSL? This seems like a waste of time.

This is a demo of Nginx’s capability in Windows. But your suggestion is well-taken and I’d like to thank you for the topic idea.

Comments are closed.

6 Ways to Check Hard Disk Health on Windows 10

8 Ways to Quickly Turn Off Your Screen in Windows 10

Latest Windows 10 Update Problems and How to Fix Them

13 Cool 4K Desktop Backgrounds for Windows 10

5 of the Best Ebook Readers for Windows 10

How to Remove Old and Useless Drivers in Windows 10

5 Lightweight Browsers for Windows 10

Читайте также:  Какую версию windows выбрать для дома

Find and Open Files Using Command Prompt in Windows 10

How to Increase the Maximum Volume in Windows 10

How to Fix Webcam or Camera Not Working in Windows 10

Affiliate Disclosure: Make Tech Easier may earn commission on products purchased through our links, which supports the work we do for our readers.

Nginx Windows: How to Install

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.

Download & Extract Nginx

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 C:nginx .

Verify Nginx Windows Installation

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.

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.

Install Nginx Windows Service

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 nginxsvc.exe .

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:

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!

Оцените статью