下载window版
http://nginx.org/download/nginx-1.9.4.zip
1、 解压到 F:/wnmp/nginx
2、 黑窗口 cd f:/wnmp/nginx
3、 输入start nginx.exe 启动
4、 浏览器输入localhost
Wellcome to nginx~
5、 创建自己的虚拟主机
修改配置文件,复制一段server,如下
#创建虚拟主机
server {
listen 80;
server_name well.com;
location / {
root F:/wnmp/root;
index index.html index.htm;
}
}
6、 win+R 输入drivers 修改hosts文件
7、 127.0.0.1 well.com
8、nginx.exe –s reload 重新加载配置文件
9、在自定义的根目录F:/wnmp/root下建立index.html文件,内容随意
10、浏览器输入well.com
访问成功~
11、下载PHP
http://windows.php.net/download#php-5.5
12、修改php.ini配置cgi监听9000端口
打开 cgi.fix_pathinfo=1
修改扩展目录
extension_dir = “F:/wnmp/php/ext”
13、修改nginx.conf虚拟主机配置、让其支持Php
location ~\.php$ {
root F:/wnmp/root;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_read_timeout 150;
fastcgi_param SCRIPT_FILENAME F:/wnmp/root/$fastcgi_script_name;
include fastcgi_params;
}
14、参考如下配置启动或关闭
http://blog.csdn.net/johnnycode/article/details/40148171
start.bat如下
@echo off
set PHP_FCGI_MAX_REQUESTS=1000
echo Starting PHP FastCGI...
RunHiddenConsole F:/wnmp/php/php-cgi.exe -b127.0.0.1:9001 -c F:/wnmp/php/php.ini
echo Starting nginx...
RunHiddenConsole F:/wnmp/nginx/nginx.exe -pF:/wnmp/nginx
Stop.bat如下
@echo off
echo Stoppingnginx...
taskkill /F /IMnginx.exe > nul
echo StoppingPHP FastCGI...
taskkill /F /IMphp-cgi.exe > nul
exit
期间遇到缺少windows扩展这个问题
解决参考http://blog.csdn.net/w6611415/article/details/12718749
虽然是64位的系统,但是下载了x86那个,问题得到解决
15、下载mysql 这里下载的是zip包
http://dev.mysql.com/downloads/windows/installer/
参考http://jingyan.baidu.com/article/f3ad7d0ffc061a09c3345bf0.html安装
解压配置环境变量 F:/wnmp/mysql/bin;
复制my-default.ini 为my.ini,在其中配置:
basedir=F:/wnmp/mysql
datadir=F:/wnmp/mysql/data
cmd安装:
F:\wnmp\mysql\bin>mysqld.exe –install
Service successfully installed.
设置root用户密码
Mysql> setpassword for root@localhost = password(‘root’);
16、在php.ini中开启mysql扩展
extension=php_mysql.dll
17、修改php.ini设置时区
date.timezone =PRC
18、开启你的php+nginx+mysql开发之旅吧~