window nginx/php

最后更新于:2022-04-02 02:34:50

[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 ``` ## 方式二 安装 php ``` choco install php --version=7.4.28 -y ``` 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 ``` PHP PHP PHP php-cgi.exe php-cgi-stop.bat LOGFILES -b 127.0.0.1:9000 ``` 3. 注册服务 ``` php-cgi-service install ```
';