Step1. Download required resources.
- Nginx for windows
- PHP binary for windows
- RunHiddenConsole.exe — a tiny tool to run program with hidden console (md5sum is
abc6379205de2618851c4fcbf72112eb
)
Step2. Extract downloaded files
- extract Nginx to
c:\nginx
- extract PHP to
c:\nginx\php
- place RunHiddenConsole.exe in
c:\nginx\RunHiddenConsole.exe
Step3. Configure Nginx with PHP
Edit c:\nginx\conf\nginx.conf
to uncomment sections of PHP and set path of your php script(I set as Nginx root path html
):
1 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 |
Step4. create batch scripts start-nginx.bat
and stop-nginx.bat
in c:\nginx
start-nginx.bat
to start service
1 | RunHiddenConsole c:\nginx\php\php-cgi.exe -b 127.0.0.1:9000 -c c:\nginx\php\php.ini |
[stop-nginx.bat]
to stop service
1 | @ECHO OFF |
Step5. Run c:\nginx\start-nginx.bat
then your Nginx+PHP HTTP server is
ready!