- Running Nginx on Bash for Windows 10
- Как установить и запустить Nginx на Windows 10
- Скачать Nginx:
- Установка и запуск Nginx:
- Nginx запуск на Windows 10:
- Настройка Nginx:
- How to install Nginx + php + MySQL on WSL Windows 10
- Virtualbox Ubuntu Nginx not working on Windows 10 [closed]
- 2 Answers 2
- nginx под Windows
Running Nginx on Bash for Windows 10
Posted 24 June, 2016
I normally go for Apache as my go-to webserver, lately however I got a liking to Nginx, for no real reasons except for the fact it has a nicer config layout. (a bad reason is a reason non the less) So when I installed Bash for Windows 10, I when and tried Nginx, sadly it didn’t work, and still doesn’t work nicely. I however got it running, this is how : First, install Nginx.
Then I wanted to ignite Nginx, but that did not work, starting Nginx failed cause of port 80 was in use.
Since I am running two systems (Linux and Windows 10) there are plenty of places to look. I started with the location I know best and was most unlikely the problem : Linux. Using netstat -tulpn | grep 80 I verified nothing was running on this freshly installed UbuntuBash. So onto W10, I know Skype, Apache, … uses port 80, but that did not run, so the hunt continued. I finally found -using resmon.exe – under Listener-port the problem, port 80 was being used by System (PID 4) … not something you can easily kill …
PID 4 (Sytem) was listening on port 80. (no longer seen here)
I dug a bit further and found this useful post. You have to stop some service, this is done using :
- windows key + x
- select console (admin)
- run net stop http
net stop http in Windows 10 (in dutch)
After that I retried nginx to once again be shown an error :
That was solved using this -still open- bugreport on github. The essence is add the following to /etc/nginx/nginx.conf :
Now to be honest I have got no idea, what any of those parameters do. (note) I tried w/o the daemon parameter and it works as well, so I only use master_process and everything seems to “work”. (different from the solution on github!)
After this, Nginx is running nicely on my BashOnWindows. Pretty nice work, Windows !
On my second machine I also had to change /etc/nginx/sites-available/default the following line :
This probably cause some ipv6 problem. (this is development only anyway!)
Как установить и запустить 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», в качестве значения используете путь до папки с вашим сайтом.
How to install Nginx + php + MySQL on WSL Windows 10
Although Nginx is available for Windows 10/8/7, however, to really understand, experience, build or test web application around, I recommend using it on Linux. And the Windows 10 WSL is the best option to run Linux+Nginx+PHP+MySQL stack to get a complete Linux based web server without really installing a separate Linux distro.
Thus, let’s see how to install Linux+Nginx+PHP+MySQL stack on Windows 10 WSL (Windows Subsystem for Linux).
What is Nginx?
Nginx (engine x) is a high-performance HTTP and reverse proxy web server that also provides IMAP/pop3/smtp services.
It is distributed under a BSD-like agreement and characterized by less memory and strong concurrent power. Nginx can be compiled and run on most Unix & Linux os and has a Windows port too.
In the case of high concurrency, Nginx is a good alternative to the Apache service: Nginx is one of the software platforms that dominating web hosting business supporting responses up to 50 000 concurrent connections thanks to Nginx for choosing Epoll and Kqueue as the development model.
The Nginx code is written entirely from the c language and has been ported to many architectures and operating systems including Linux, FreeBSD, Solaris, mac os x, AIX, and Microsoft windows.
Nginx has its own library of functions, and in addition to zlib, PCRE, and OpenSSL, standard modules only use system C library functions. Also, these third-party libraries may not be used if you do not need or consider potential authorization conflicts.
Virtualbox Ubuntu Nginx not working on Windows 10 [closed]
Want to improve this question? Update the question so it’s on-topic for Stack Overflow.
Closed 4 years ago .
I have installed a fresh Ubuntu 16.04-server on Virtualbox on my Windows 10. After the installation I installed Nginx. I set the port to 81 because port 80 is being used by a process I can’t identify. I can ping the IP of the VBox which is 10.0.2.15 and when going to http://localhost:81 or http://10.0.2.15:81 or http://127.0.0.1:81, nothing is displayed. Tried to Google this problem but still unable to figure out how to solve it. Could there be a conflict with my XAMPP installation or my modified windows hosts file I added some redirects for my local development for XAMPP like dev.myproject.com and test.myproject.com
2 Answers 2
VirtualBox creates virtual machines with the NAT network type by default. If you want to access a web server as nginx inside a virtual machine, you’ll need to forward all necessary ports through the virtual NAT into the vm. Just do the following:
- Open your virtual machine’s settings window.
- Select the Network pane, check that you are using NAT, expand the Advanced section and click on the Port Forwarding button.
- Create a port forwarding rule. Specifying a host and/or guest IP is optional, so just leave it blank. The host port is the port from which you want to access the web server from the outside, e.g. 2215, and the guest port is the port on which your web server is actually running within the vm, e.g. 81.
Now you can access the web server by opening http://hostip:2215 . Another solution would be a proxy pass/proxy pass reverse.
If your VM has an IP address on it’s own (you can find out by)
1- inside your terminal, type in ifconfig and see if you have a new ip address in your machine, this is your ip address 2- you might need to use iptables inside your linux machine to open up port 81 as I don’t think it is open by default. you can try from within your Ubuntu telnet <
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-стиле с использованием прямых слэшей:
nginx/Windows работает как стандартное консольное приложение (не сервис) и управляется при помощи следующих команд: