nginx php5.3 mysql_WNMP环境搭建步骤 nginx1.4.3+php-5.3.27+mysql-5.5+RunHiddenConsole

本文详细介绍了在Windows上搭建WNMP(Windows+Nginx+MySQL+PHP5.3.27)开发环境的步骤,包括软件下载、安装路径、配置文件修改以及服务的启动和停止方法。
摘要由CSDN通过智能技术生成

安装目录: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 ]

php [args...]

-a               Run interactively

-b | Bind Path for external FASTCGI Server mode

-C               Do not chdir to the script's directory

-c | 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         Parse .  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         Load Zend extension .

-T        Measure execution time of script repeated times.

+-------------------------------------------------------------+

四、配置完毕,启动nginx和php-cgi之后

1、根目录新建 index.php

+-------------------------------------------------------------+

phpinfo();

?>

+-------------------------------------------------------------+

2、在浏览为输入 localhost/index.php  应该看到可爱的info页面了。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值