Last active
March 18, 2019 09:05
-
-
Save abdulhadad/f0f29ad173752b4216e46185659bd80b to your computer and use it in GitHub Desktop.
Nginx PHP FastCGI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
server { | |
listen 80; | |
server_name localhost; | |
location / { | |
root html; | |
index index.html index.htm; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
location ~ \.php$ { | |
root html; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Based on https://www.nginx.com/resources/wiki/start/topics/examples/phpfastcgionwindows/ | |
REM Download Windows Nginx at http://nginx.org/en/docs/windows.html | |
REM PHP 7 NTS at https://windows.php.net/download/ | |
REM RunHiddenConsole http://redmine.lighttpd.net/attachments/660/RunHiddenConsole.zip | |
REM And put on source folder | |
REM Make custom nginx.conf | |
set _source_dir="C:\Users\Wnnt\Documents\PHPProjects\WindowsPHPNginx" | |
set _7zip_path="c:\Program Files\7-Zip" | |
set _nginx_ver=nginx-1.15.9 | |
set _php_ver=php-7.3.3-nts-Win32-VC15-x64 | |
set _run_hidden=RunHiddenConsole.zip | |
set _nginx_dir=c:\%_nginx_ver% | |
set _php_dir=c:\php | |
REM extracting application | |
%_7zip_path%\7z.exe x %_source_dir%\%_nginx_ver%.zip -o%_php_dir%\.. | |
%_7zip_path%\7z.exe x %_source_dir%\%_php_ver%.zip -o%_php_dir% | |
%_7zip_path%\7z.exe x %_source_dir%\%_run_hidden% -o%_nginx_dir% | |
REM create nginx.conf | |
move %_nginx_dir%\conf\nginx.conf %_nginx_dir%\conf\nginx.conf.orig | |
copy %_source_dir%\nginx.conf %_nginx_dir%\conf | |
REM create info.php | |
REM for display php runtime information | |
echo ^<?php phpinfo(); ?^> > %_nginx_dir%\html\info.php | |
REM create start-stop-nginx-php.bat | |
REM for starting and stoping nginx | |
echo @echo off > %_nginx_dir%\start-stop-nginx-php.bat | |
echo echo Starting PHP FastCGI... >> %_nginx_dir%\start-stop-nginx-php.bat | |
echo set PATH=%_php_dir%;%%PATH%% >> %_nginx_dir%\start-stop-nginx-php.bat | |
echo %_nginx_dir%\RunHiddenConsole.exe %_php_dir%\php-cgi.exe -b 127.0.0.1:9000 -c %_php_dir%\php.ini >> %_nginx_dir%\start-stop-nginx-php.bat | |
echo cd %_nginx_dir% >> %_nginx_dir%\start-stop-nginx-php.bat | |
echo start %_nginx_dir%\nginx.exe >> %_nginx_dir%\start-stop-nginx-php.bat | |
echo echo open http://localhost/info.php to check >> %_nginx_dir%\start-stop-nginx-php.bat | |
echo echo Press enter to stop >> %_nginx_dir%\start-stop-nginx-php.bat | |
echo pause >> %_nginx_dir%\start-stop-nginx-php.bat | |
echo taskkill /f /IM nginx.exe >> %_nginx_dir%\start-stop-nginx-php.bat | |
echo taskkill /f /IM php-cgi.exe >> %_nginx_dir%\start-stop-nginx-php.bat | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment