May 11, 2021 PHP
NGINX can connect to PHP on Windows through the FastCGI daemon
You can use php-cgi .exe -b 127.0.0.1:-port-and-fastCGI
After startup, php-cgi .exe continue to listen for connections in the command prompt window.
If you want to hide the window, use a small utility: RunHiddenConsole
1. Download Nginx download address as needed: http://nginx.org/en/download.html
2. Unzip the downloaded package
This allows you to use cmD to enter the D: snginx-1.10.3; to perform start-up, close, restart, and so on, and you can do the following
nginx -s stop 快速关闭Nginx
nginx -s quit 优雅的关闭Nginx
nginx -s reload 更改配置,使用新配置启动新工作进程,正常关闭旧工作进程
nginx -s reopen 重新打开日志文件
1. Download PHP download address as needed: https://windows.php.net/
2. Unzip the downloaded package
This allows you to use the CMD to enter the D:-php-5.6.34-Win32-VC11-x64-gt;
D:\php-5.6.34-Win32-VC11-x64>php-cgi.exe -b 127.0.0.1:9000
nginx.conf (the file is in the conf of the nginx installation directory, as mine is: D:\nginx-1.10.3?conf)
server {
listen 80;
server_name localhost;
root html;
index index.php;
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php$1 last;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~* .*\.php($|/)
{
if ($request_filename ~* (.*)\.php) {
set $php_url $1;
}
if (!-e $php_url.php) {
return 403;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
Note: The Windows version of nginx is implemented using the native Win32 API instead of using Cygwin impersonation. N
ow only select() connection processing is used, so don't expect high performance and scalability, plus there are a lot of other issues, and now the Windows version of nginx is a BETA version.
The following is an official description
Version of nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the select() connection processing method is currently used, so high performance and scalability should not be expected. Due to this and some other known issues version of nginx for Windows is considered to be a beta version.