windows下WNMP(windows+nginx+mysql+php)配置
1.下载
NGINX-1.8.0官网下载: http://nginx.org/en/download.html
PHP5.6.15版本下载地址: http://windows.php.net/download/
Mysql5.5.19版本下载地址: http://www.mysql.com/downloads/mysql/
2.安装Mysql
配置时用户名root,密码root,字符编码utf8,utf8_general_ci
3.解压NGINX和PHP到你自己安装位置
这里我在D盘新建一个文件夹:WNMP(windows,ngnix,mysql,php),把下面的软件安装到这个文件夹里面。
NGINX目录D:\WNMP\nginx
PHP目录D:\WNMP\php
4.安装nginx
(1).打开D:\WNMP\nginx目录,运行该文件夹下的nginx.exe
(2).测试是否启动nginx。打开浏览器访问 http://localhost 或 http://127.0.0.1,看看是否出现“Welcome to nginx!”,出现的证明已经启动成功了。没有启动的话,看看80端口有没有被占用。
注意:该网站的默认目录在“D:\WNMP\nginx\html”下
5.安装php(这里主要讲nginx配置启动php,以cgi运行php)
(1).修改nginx配置文件是D:\WNMP\nginx\conf\nginx.conf
修改大概第43~45行之间的
location / {root html;index index.html index.htm;}
更改root目录,添加index.php
location / {root D:/WNMP/nginx/html;index index.html index.htm index.php;}
修改大概在第63-71行的
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##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;#}
更改root目录,更改/scripts为$document_root
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#location ~ \.php$ {root D:/WNMP/nginx/html;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}
(2)更改php目录下的php.ini-development,将文件名改为php.ini,进行如下配置
搜索“extension_dir”,找到: e;xtension_dir = "ext" 先去前面的分号再改为 extension_dir = "D:\WNMP\php\ext"
搜索“date.timezone”,找到:;date.timezone = 先去前面的分号再改为 date.timezone = Asia/Shanghai
搜索“enable_dl”,找到:enable_dl = Off 改为 enable_dl = On
搜索“cgi.force_redirect” ;cgi.force_redirect = 1 先去前面的分号再改为 cgi.force_redirect = 0
搜索“fastcgi.impersonate”,找到: ;fastcgi.impersonate = 1 去掉前面的分号
搜索“cgi.rfc2616_headers”,找到:;cgi.rfc2616_headers = 0 先去前面的分号再改为 cgi.rfc2616_headers = 1
搜索“php_mysql”,找到:”extension=php_mysql.dll和extension=php_mysqli.dll 去掉前面的“;”extension=php_mysql.dll和extension=php_mysqli.dll (支持MYSQL数据库)
其他的配置请按照自己的需求更改。
6.运行
(1).编辑info.php内容如下,放到D:\WNMP\nginx\html目录
<?php
phpinfo();
?>
(2).切换到php目录,执行如下命令运行php,如果出现找不到msvcr110.dll的情况,请自行下载安装VC++2012运行库
D:
cd D:\WNMP\php
php-cgi.exe -b 127.0.0.1:9000-c D:\WNMP\php\php.ini
(3).切换到nginx目录,重启nginx.exe,
D:
cd D:\WNMP\nginx
nginx -s reload
(4).浏览器访问 http://127.0.0.1/info.php
如果出现PHP版本信息说明配置成功
7.测试mysql
(1).编辑sqltest.php内容如下,放到D:\WNMP\nginx\html目录
<?php
$link=mysql_connect("localhost","root","root");
if(!$link) echo "FAILD!";
else echo "OK!";
?>
(2)如果提示mysql_connect将被废弃建议使用mysqli or PDO,请使用下面的代码连接
使用mysqli连接的代码
<?php
$link = new mysqli('localhost', 'root', 'root');
if(!$link) echo "FAILD!";
else echo "OK!";
?>
(3)浏览器访问 http://127.0.0.1/sqltest.php
如果页面显示OK,说明mysql配置成功
8.附:nginx常用命令
nginx -s stop 强制关闭
nginx -s quit 安全关闭
nginx -s reload 改变配置文件的时候,重启nginx工作进程,来时配置文件生效
nginx -s reopen 打开日志文件
windows下WNMP(windows+nginx+mysql+php)配置相关推荐
- windows下python+django+pycharm+mysql从配置到实战
Mac 基于Python搭建Django应用框架 https://www.jianshu.com/p/b2b9bf41da4f 基于Python搭建Django后台管理系统 https://blog. ...
- linux怎么在win上安装mysql_CentOS下安装MySQL及Windows下使用Navicat for MySQL连接
安装 查看有没有安装过: yum list installed mysql* rpm -qa | grep mysql* 查看有没有安装包: yum list mysql* 安装mysql客户端: y ...
- mysql数据库解压安装教程_MySQL数据库之windows 10下解压版MySql安装配置方法教程...
本文主要向大家介绍了MySQL数据库之windows 10下解压版MySql安装配置方法教程 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助. windows 10 下安装解压版的 ...
- windows下bat处理执行Mysql的sql语句
这篇文章主要介绍了windows下bat批处理执行Mysql的sql语句,需要的朋友可以参考下 有时候我们需要用bat来定时执行mysql那么就可以参考下面的代码 直接上代码: @ECHO OFF S ...
- Windows下访问VirtualBox的mysql服务
由于好长时间没有在windows下使用mysql,现在出现好多选项,而且使用sqlyog连接总是出现1045错误,所以在虚拟机Ubuntu下安装mysql进行访问,但是想用win下面vscode进行开 ...
- Trac系列(1):Windows下Trac的安装与基本配置
Windows下Trac的安装与基本配置 Trac是一个基于Web的,轻量级的项目管理工具,它使用python语言编写.在本文中,将介绍windows下安装.集成配置一个简单的Trac ...
- windows下彻底关闭nginx服务
windows下彻底关闭nginx服务 在nginx目录下打开cmd窗口 运行命令:start nginx 启动nginx服务 运行命令:nginx -s stop 停止nginx服务 运行命令:ng ...
- windows下rpc框架thrift的环境配置
windows下rpc框架thrift的环境配置 引用链接: https://www.cnblogs.com/49er/p/7193829.html 最近在弄windows下 的Facebook的rp ...
- Windows下SonarQube与Jenkins环境的配置使用
Windows下SonarQube与Jenkins环境的配置使用 首先放个SonarQube官方持续化集成测试环境架构图 图中展示了SonarQube自动化环境的整合,前文根据SonarQube官方的 ...
最新文章
- js控制table中tr位置互换
- python入门常识
- linux网络编程之sockaddr_in和in_addr区别
- 职称计算机excel2015年,2015年职称计算机《Excel2003》最新章节练习题(5)
- linux安装配置java,Linux 安装配置 java 环境
- Liferay Portal使用MySQL数据库配置
- 练习瑜伽中常见的三大误区
- 程序员面试金典——9.8硬币表示
- 如何求递归算法的时间复杂度
- jQuery整理您的笔记----jQuery开始
- SimpleLPR车牌自动识别,一张图片就可识别
- plpgsql 编译执行
- Oracle数据库分页
- 暑假爆肝整理这篇python基础教程,全是干货,学完基础就过关(收藏加好评吧)
- linux开机启动grub rescue,Ubuntu 开机出现 grub rescue 的模式下修复
- OGG/OGV文件格式解析
- 操作系统课程项目 OS project —— Pintos from Project 1 to Project 3
- HW算法题:判断字符串子序列
- 蒙氏三段卡素材---蚂蚱三段卡
- RMAN crosscheck archivelog all; 失败!