以前一直用apache,直接下个wamp一键安装ok能用了,今天用nginx服务器了,苦B的装php装mysql装nginx再装redis,还有麻烦的配置和版本的对应,装完我十分不爽就琢磨着能不能把wamp的Apache换成nginx接着用所以实现吧,
我的wamp是安装在D盘的目录如下D:\wamp;
把nginx解压包放在这里D:\wamp\bin\
因为wamp的php的配置文件时放在D:\wamp\bin\apache\apache2.2.22\bin之下面的 所以在这里拷贝一份php.ini放在D:\wamp\bin\php\php5.3.13\下面
注:为什么要拷贝呢? 答: 俺已经对php做了些配置不想重新配置所以拷贝, 懒人需要懒招啊!!!
接下来配置nginx下nginx 和php配置文件 参照http://blog.csdn.net/qinglianluan/article/details/24649579
redis解压之后放在D:\redis-2.6
别忘了打开php的redis扩展:extension=php_redis.dll 前提php的ext文件夹下已有redis扩展文件
在下载一个RunHiddenConsole放在D:\wamp\bin\nginx-1.5.0\
RunHiddenConsole下载地址:http://download.csdn.net/detail/neilson123456/7375513 或 http://redmine.lighttpd.net/attachments/660/RunHiddenConsole.zip
然后启动nginx php mysql 的脚本要这样写,保存start.bat
@echo off
echo Starting PHP FastCGI...
D:\wamp\bin\nginx-1.5.0\RunHiddenConsole.exe D:\wamp\bin\php\php5.3.13\php-cgi.exe -b 127.0.0.1:9000 -c D:\wamp\bin\php\php5.3.13\php.ini
echo Starting nginx...
D:\wamp\bin\nginx-1.5.0\RunHiddenConsole.exe D:\wamp\bin\nginx-1.5.0\nginx.exe -p D:\wamp\bin\nginx-1.5.0
echo Starting mysql...
D:\wamp\bin\nginx-1.5.0\RunHiddenConsole.exe D:\wamp\bin\mysql\mysql5.5.24\bin\mysqld
echo Starting Redis...
D:\wamp\bin\nginx-1.5.0\RunHiddenConsole.exe D:\redis-2.6\redis-server.exe
停止脚本这样写,保存stop.bat
@echo off
echo Stopping nginx...
taskkill /F /IM nginx.exe > nul
echo Stopping PHP FastCGI...
taskkill /F /IM php-cgi.exe > nul
echo Stopping mysql...
taskkill /F /IM mysqld.exe > nul
echo Stopping redis...
taskkill /F /IM redis-server.exe > nul
exit
OK大功告成,现在可以一键开启和关闭了