heberoxx 发表于 2018-11-15 10:19:11

windows 安装 nginx步骤

  1 下载并解压到 D:\nginx 目录
  2 配置 PHP FastCGI Nginx 需要和 FastCGI Server 配合才能处理请求,有两种方式运行 PHP FastCGI Server,一种就是使用 PHP 内置的 FastCGI 管理器:
  
命令行下面执行c:/php/php-cgi.exe -b 127.0.0.1:9000 -c c:/php/php.ini 以启动PHP FastCGI
  3 修改 php.ini 中的 cgi.fix_pathinfo = 1
  4 修改 d\nginx\conf\nginx.conf 中的关于php的部分
  


[*]#PHP 脚本请求全部转发到 FastCGI处理. 使用FastCGI默认配置.
[*]location ~ \.php$ {
[*]fastcgi_pass   127.0.0.1:9000;
[*]fastcgi_indexindex.php;
[*]fastcgi_paramSCRIPT_FILENAMED:\\www\\$fastcgi_script_name;
[*]include      fastcgi_params;
[*]}
  

  5 开启关闭批处理
  start_nginx.bat,用于同时启动 PHP FastCGI 和 Nginx:
  
@echo off
  
echo Starting PHP FastCGI...
  
RunHiddenConsole c:/php/php-cgi.exe -b 127.0.0.1:9000 -c c:/php/php.ini
  
echo Starting nginx...
  
d:/nginx/nginx.exe
  
RunHiddenConsole.exe 是一个用来隐藏 DOS 窗口的小程序,可以在这里下载RunHiddenConsole.zip (1.01 kb)。
  
start_nginx.bat 开启后,也会有 DOS 窗口,但是可以安全的关掉,并不会关闭 Nginx 和 php-cgi.exe。
  
stop_nginx.bat,用来关闭:
  
@echo off
  
echo Stopping nginx...
  
taskkill /F /IM nginx.exe > nul
  
echo Stopping PHP FastCGI...
  
taskkill /F /IM php-cgi.exe > nul
  
exit
  
到这里基本配置完毕了。


页: [1]
查看完整版本: windows 安装 nginx步骤