nulecho Stopping PHP FastCGI…taskkill /F /IM php-cgi.exe >nulexit####restart.bat@echo offecho Stopping Nginx…taskkill /F /IM nginx.exe >nulecho Stopping PHP FastCGI…taskkill /F /IM php-cgi.exe >nulset PHP_FCGI_MAX_REQUESTS=1000echo ———————–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.iniecho PHP FastCGI OK..echo Starting Nginx…RunHiddenConsole C:/server/bin/nginx/nginx.exeecho nginx is running!exit[/code],风一样的男孩's Blog - 创造机会的人是勇者;等待机会的人是愚者" /> windows下安装配置Nginx+PHP - 风一样的男孩's Blog

windows下安装配置Nginx+PHP

我的安装测试环境是:
Windows XP

Nginx/Windows 0.8.40
PHP 5.2.9-1
步骤如下:
1.配置PHP.ini

cgi.fix_pathinfo=1

[Zend]
zend_extension_manager.optimizer_ts="E:\Zend\ZendOptimizer-3.3.0\lib\Optimizer-3.3.0"
zend_extension_ts="E:\Zend\ZendOptimizer-3.3.0\lib\ZendExtensionManager.dll"
extension_dir = "E:/PHP/ext/"
extension=php_gd2.dll
extension=php_mysql.dll

display_errors = on
short_open_tag = on


2.配置nginx.conf

location ~ \.php$ {
      root           html;
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index  index.php;
      fastcgi_param  SCRIPT_FILENAME  /scripts $fastcgi_script_name;
      include        fastcgi_params;
}
/scripts 改为 $document_root


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


[本日志由 风一样的男孩 于 2010-08-25 10:01 AM 编辑]
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: Nginx php
相关日志:
评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.