ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 概述 windows 环境下 nginx 与 php-fpm 配合 ## 1.安装 nginx 用nginx 安装 ``` choco install nginx -y ``` 设置配置文件 需要使用觉得路径 ``` http { ... include C:/tools/nginx-1.21.6/conf/vhosts/*.conf; } ``` 在 vhost/xxx.conf ``` server { listen 80; server_name localhost; root you_root_path; #charset koi8-r; #access_log logs/yun_zhong_can.access.log main; location / { index index.html index.htm index.php; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } ``` ## 2.安装 php ## 方式一 ``` choco install php-service --version=7.4.13 ``` ## 方式二 **1.安装 php** ``` choco install php --version=7.4.28 -y ``` **2.php 注册成服务** 参考 https://github.com/sheggi/win-service-php-cgi 1. 先下载 [winsw](https://github.com/winsw/winsw/releases) 并改名为 `php-cgi-service.exe` 2. 添加配置文件 php-cgi-service.xml ``` <service> <id>PHP</id> <name>PHP</name> <description>PHP</description> <executable>php-cgi.exe</executable> <stopexecutable>php-cgi-stop.bat</stopexecutable> <env name="PHPRC" value="C:\tools\php81" /> <logpath>LOGFILES</logpath> <log mode="roll"></log> <arguments>-b 127.0.0.1:9000</arguments> </service> ``` 3. 注册服务 ``` php-cgi-service install ```