安装目录:D:/webServer/
所需软件:
mysql-installer-community-5.5.34.0.msi
下载:http://cdn.mysql.com/Downloads/MySQLInstaller/mysql-installer-community-5.5.34.0.msi
php-5.3.27-Win32-VC9-x86.zip
下载:http://windows.php.net/downloads/releases/php-5.3.27-Win32-VC9-x86.zip
nginx-1.4.3.zip
下载:http://nginx.org/download/nginx-1.4.3.zip
RunHiddenConsole.zip #一个是程序在后台运行的命令行软件
下载:http://119.188.72.52/7/ishare.down.sina.com.cn/17366991.zip?ssig=bkKdOMhRA%2B&Expires=1384272000&KID=sina,ishare&fn=RunHiddenConsole.zip
一、安装步骤:
1、安装数据库:mysql-installer-community-5.5.34.0.msi 到 D:/webServer/mysql55。
2、解压php-5.3.27-Win32-VC9-x86.zip 到 D:/webServer/php53。
3、解压nginx-1.4.3.zip 到 D:/webServer/ngnix14。
二、配置:
1、配置D:/WebServer/nginx14/conf/nginx.conf
a) 修改根目录
+-------------------------------------------------------------+
location / {
root html; #####这里修改成实际的根目录
index index.html index.htm index.php;
}
+-------------------------------------------------------------+
b) 使nginx支持php
+-------------------------------------------------------------+
location ~ \.php$ {
# root html;#####这里修改成实际的根目录, 可以继承上面的。
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #########修改成$document_root
include fastcgi_params;
}
+-------------------------------------------------------------+
三、 启动终止服务
1、nginx
a) 启动:
+-------------------------------------------------------------+
C:\Documents and Settings\Administrator>d:
D:\>cd webServer\nginx14
D:\webServer\nginx14>nginx.exe
+-------------------------------------------------------------+
b) 停止:
+-------------------------------------------------------------+
C:\Documents and Settings\Administrator>d:
D:\>cd webServer\nginx14
D:\webServer\nginx14>nginx.exe -s stop
+-------------------------------------------------------------+
或者
//直接杀死进程
+-------------------------------------------------------------+
C:\Documents and Settings\Administrator>tskill nginx
+-------------------------------------------------------------+
c) 帮助
+-------------------------------------------------------------+
D:\webServer\nginx14>nginx.exe -h
nginx version: nginx/1.4.3
Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: NONE)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file
+-------------------------------------------------------------+
2、php-cgi
a) 启动:
+-------------------------------------------------------------+
C:\Documents and Settings\Administrator>d:
D:\>cd webServer\php53
D:\webServer\php53>php-cgi.exe -b 127.0.0.1:9000
+-------------------------------------------------------------+
以上启动方式的cmd窗口不会自动关闭,也就是没有在后台运行。 解决方法如下:
解压 RunHiddenConsole.zip 内的 RunHiddenConsole.exe 到 D:/webServer/php53/ 目录内,然后执行以下命令
+-------------------------------------------------------------+
C:\Documents and Settings\Administrator>d:
D:\>cd webServer\php53
D:\webServer\php53>start RunHiddenConsole.exe php-cgi.exe -b 127.0.0.1:9000
+-------------------------------------------------------------+
b) 停止:
+-------------------------------------------------------------+
C:\Documents and Settings\Administrator>tskill php-cgi
+-------------------------------------------------------------+
c) 帮助
+-------------------------------------------------------------+
D:\webServer\php53>php-cgi.exe -h
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]
php <file> [args...]
-a Run interactively
-b <address:port>|<port> Bind Path for external FASTCGI Server mode
-C Do not chdir to the script's directory
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse <file>. Implies `-q'
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
-T <count> Measure execution time of script repeated <count> times.
+-------------------------------------------------------------+
四、配置完毕,启动nginx和php-cgi之后
1、根目录新建 index.php
+-------------------------------------------------------------+
<?php
phpinfo();
?>
+-------------------------------------------------------------+
2、在浏览为输入 localhost/index.php 应该看到可爱的info页面了。。