確認環境

Env Ver
Windows 10 pro
PHP 8.0.2 NTS Visual C++ 2019 x64
nginx 1.19.8

手順

  1. nginx.confを開き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  C:/nginx/html/$fastcgi_script_name;
        include        fastcgi_params;
    }
    
  2. 設定したフォルダに.phpファイルを配置
  3. nginxを起動
  4. php-cgi.exe -b 127.0.0.1:9000
  5. .phpファイルにアクセス

サービス化する

  • winswを使うとできるらしい