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

你可能感兴趣的:(windows下安装配置Nginx+PHP)