Installation NginX on Windows

Posted by Rahman M On Monday, August 26, 2013 5 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:
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 -c c:\nginx\php\php.ini"
ping >NUL
then save it as a start-nginx.bat

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

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



Anonymous said...

great articles...

hari said...

My operating system is windows XP 32 bit.
Currently i have tried apache http server for clustering.
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?

modells said...

Or you could use WT-NMP – Windows Nginx MySql Php stack

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!

Anonymous said...

how to using nginx+php+sqlite, that's now, sqlite3 include in php5. tnx

Sergey said...

Here is the new article I posted recently about installing Nginx on Windows with Docker

Post a Comment