Nginx is one of the web servers are already widely used and increasingly compete with the Apache web server, given the already widely used, the following I give a little tutorial on Nginx install on windows.
Nginx on windows may not run automatically through service windows, for that we will make the script so that nginx can run automatically when Windows is running.
First, we will create a script that can be run automatically nginx.
open notepad, then type the following script:
open notepad, then type the following script:
then save it as a start-nginx.bat@ECHO OFF
cd c:\nginx\
echo Starting Nginx...
start /B cmd /K "c:\nginx\nginx.exe"
echo Start Php-cgi...
start /B cmd /K "c:\nginx\php\php-cgi.exe -b 127.0.0.1:9000 -c c:\nginx\php\php.ini"
ping 127.0.0.1 >NUL
EXIT
next we will create a script to stop nginx.
open notepad and type the following script:
@ECHO OFFthen save it as a stop-nginx.bat
Taskkill /F /im nginx.exe
Taskkill /F /im php-cgi.exe
up to this point has been able to run nginx automatically using windows or startup schedule, but when run CMD command window will appear. to hide the CMD command make the following script.
Set WshShell = CreateObject("WScript.Shell")then save it as a start-nginx.vbs
WshShell.Run chr(34) & "start-nginx.bat" & Chr(34), 0
Set WshShell = Nothing
try to run the start-nginx.vbs, if not visible CMD command means write the code is correct. then you can create a startup on Windows.
good luck ...
5 Comments
great articles...
ReplyDeleteSir
ReplyDeleteMy operating system is windows XP 32 bit.
Currently i have tried apache http server for clustering.
Now
I want to use NginX for clustering , but unable to start the nginX in windows XP.
Also want to know whether NginX can be used on windows server 2008 64 bit or not?
Or you could use WT-NMP – Windows Nginx MySql Php stack
ReplyDeletehttp://wtriple.com/wtnmp
A portable, preconfigured, lightweight, fast and stable server stack for developing php mysql applications on windows, based on the excellent webserver Nginx. Just unzip and start developing!
how to using nginx+php+sqlite, that's now, sqlite3 include in php5. tnx
ReplyDeleteHere is the new article I posted recently about installing Nginx on Windows with Docker https://distinctplace.com/2017/04/24/nginx-on-windows-in-5-minutes-or-less-with-docker/
ReplyDelete