(修正版)windows下安装配置Nginx0.8.49+PHP5.3.3

 

安装测试环境:
Windows 7 旗舰版
Nginx/Windows 0.8.49
PHP 5.3.3 (请下载 非线程安全版)
备注:有关于Windows下PHP线程安全版本与非线程安全版本的区别请参考 : PHP线程安全与非线程安全的区别


步骤如下:
1.配置PHP.ini
cgi.fix_pathinfo=1

2.配置nginx.conf
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;
}
location / {
            root   html;
            index  index.html index.htm index.php;
            autoindex  on;  //允许目录列表
}
3. 启动脚本(根据实际情况进行路径的修改) 
####start.bat
@echo off
echo ———————–
echo Starting PHP FastCGI…
echo ———————–
RunHiddenConsole C:/server/bin/php5/php-cgi.exe -b 127.0.0.1:9000 -c C:/server/bin/php5/php.ini
echo PHP FastCGI OK..
echo Starting Nginx…
RunHiddenConsole C:/server/bin/nginx/nginx.exe
echo nginx is running!exit
####stop.bat
@echo off
echo Stopping Nginx…
taskkill /F /IM nginx.exe >nul
echo Stopping PHP FastCGI…
taskkill /F /IM php-cgi.exe >nul
exit
####restart.bat
@echo off
echo Stopping Nginx…
taskkill /F /IM nginx.exe >nul
echo Stopping PHP FastCGI…
taskkill /F /IM php-cgi.exe >nul
set PHP_FCGI_MAX_REQUESTS=1000
echo ———————–
echo Starting PHP FastCGI…
echo ———————–
RunHiddenConsole C:/server/bin/php5/php-cgi.exe -b 127.0.0.1:9000 -c C:/server/bin/php5/php.ini
echo PHP FastCGI OK..
echo Starting Nginx…
RunHiddenConsole C:/server/bin/nginx/nginx.exe
echo nginx is running!
exit
备注:使用start.bat脚本时若出现'RunHiddenConsole不是可用的命令'的错误,
请到 http://files.cnblogs.com/skyaspnet/LightTPD.rar 下载文件包,并将解压后的文件夹里的
RunHiddenConsole.exe复制到nginx根目录下即可

你可能感兴趣的:(windows)