Sponsors

Installation NginX on Windows


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


                                                

Post a Comment

5 Comments

  1. great articles...

    ReplyDelete
  2. 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?

    ReplyDelete
  3. Or you could use WT-NMP – Windows Nginx MySql Php stack
    http://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!

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

    ReplyDelete
  5. Here 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