Installation NginX on Windows

Posted by Rahman M On Monday, August 26, 2013 2 comments

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.
 
Download Nginx from this link and PHP from this link.

Extract Nginx in folder C:\, then extract PHP in folder C:\nginx to be C:\nginx\PHP.
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:
@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
then save it as a start-nginx.bat

next we will create a script to stop nginx.
open notepad and type the following script:

@ECHO OFF
Taskkill /F /im nginx.exe
Taskkill /F /im php-cgi.exe
then save it as a stop-nginx.bat

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")
WshShell.Run chr(34) & "start-nginx.bat" & Chr(34), 0
Set WshShell = Nothing
then save it as a start-nginx.vbs

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


  

2 comments:

Anonymous said...

great articles...

hari said...

Sir
My 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?

Post a Comment