win11搭建nginx+php环境
win11搭建nginx+php环境
nginx 配置
nginx-1.24.0/nginx.conf
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
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;
}
特别注意: $document_root$fastcgi_script_name; 其中1个字符都不能错,这里是与默认的配置信息不同的。
在 html 目录下放入
index.php
<?php
phpinfo();
?>
php 的配置
D:\tools\php-7.4.33-nts-Win32-vc15-x64\php.ini
cgi.fix_pathinfo=1
extension_dir = "ext"
根据需要开放扩展库
extension=bz2
extension=gd2
extension=mbstring
extension=pdo_mysql
extension=pdo_sqlite
启动
cd /d D:\tools\nginx-1.24.0
nginx
cd /d D:\tools\php-7.4.33-nts-Win32-vc15-x64
php-cgi.exe -b 127.0.0.1:9000 -c php.ini
参考资料
windows10搭建nginx1.19.3+php7.4
https://blog.csdn.net/u014650004/article/details/109240528