Accept cookies for analytics, social media, and advertising, or learn more and adjust your preferences. These cookies are on by default for visitors outside the UK and EEA. Privacy Notice.
NGINX can interface with PHP on Windows via a FastCGI daemon, which ships with PHP: php-cgi.exe.
You need to run php-cgi.exe -b 127.0.0.1:<port>
and use fastcgi_pass 127.0.0.1:<port>;
in the NGINX configuration file.
After being launched, php-cgi.exe
will keep listening for connections in a command prompt window.
To hide that window, use the tiny utility RunHiddenConsole
php-cgi.exe
is installed in the same directory as php.exe
.c:\nginx\
) a batch file start-php-fcgi.bat
similar to this one:start-php-fcgi.bat
@ECHO OFF ECHO Starting PHP FastCGI... set PATH=C:\PHP;%PATH% c:\bin\RunHiddenConsole.exe C:\PHP\php-cgi.exe -b 127.0.0.1:9123nginx.conf
root c:/www; location ~ \.php$ { fastcgi_pass 127.0.0.1:9123; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
C:\nginx\conf\start-nginx.bat
file at system start up under the SYSTEM account in starting directory C:\nginx
.cd /d C:\cygwin\bin && bash -c /usr/local/nginx/sbin/nginx