日期:2014-05-17  浏览次数:20468 次

Windows 下Nginx+PHP 的安装与配置

<!--[if !supportLists]-->? 一.<!--[endif]-->软件准备

<!--[if !supportLists]-->1.<!--[endif]-->Nginxhttp://nginx.org/download/nginx-1.2.0.zip

<!--[if !supportLists]-->2.<!--[endif]-->phphttp://windows.php.net/download/php-5.2.17-Win32-VC6-x86.zip 这里需要注意一下,如果使用ApacheNginx运行php,要选择VC6的线程安全版本,使用IIS选择VC9版本。所以这里使用前者。

<!--[if !supportLists]-->3.<!--[endif]-->RunHiddenConsolehttp://redmine.lighttpd.net/attachments/660/RunHiddenConsole.zip 用于隐藏命令窗口。

二、安装Php

首先将上面下载的PHP解压到php的安装目录PHP_PATH,并将PHP_PATH以及PHP_PATH/ext添加到Path环境变量中。

PHP_PATH下的php.ini-dist重命名为php.ini,这个就是PHP的配置文件。然后根据需要修改这个文件。

三、安装Nginx

解压下载到的nginx-1.2.0.zip,并将其文件夹命名为nginx-1.2?,可以通过命令行的方式或者脚本的方式启动nginx,下面介绍脚本方式

分别创建一个start_nginx.bat和stop_nginx.bat文件放置在nginx的根目录下

start_nginx.bat内容如下:

@echo off

echo Starting nginx...

d:/nginx1.2/nginx.exe

stop_nginx.bat内容如下:

@echo off

echo Stopping nginx...

taskkill /F /IM nginx.exe > nul

exit

启动nginx,如果出现nginx的欢迎界面,则说明nginx安装成