参考 网上 配了 下 Nginx 写个日志 留着 备用
配置
A: Nginx:只是简单的搭配了一下,满足跑起来而已
listen 8083;
listen [::]:8083; # Ipv6
location / {
root E:/develop/www/nginx;
index index.html index.htm index.php;
}
location ~ \.php$ {
root E:/develop/www/nginx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME E:/develop/www/nginx$fastcgi_script_name;
include fastcgi_params;
}
B: PHP
cgi.fix_pathinfo=1 这个主要是用来 路径修正 即 这个 SCRIPT_FILENAME E:/develop/www/nginx$fastcgi_script_name;
运行:
A: nginx
参考网上写的 dos ( 其实 直接双击 就可以了 )
发现 直接 $ngnix$/nginx.exe 这样不行 它默认 配置文件 为 c:\user\$username$\conf/nginx.conf 但实际应该是 $ngnix$/conf/nginx.conf
$ngnix$ nginx的安装目录,下面的 同理
这样写即可
盘符:
cd $ngnix$
nginx.exe
B: php-cgi
网上 有人用 这个 RunHiddenConsole 程序来运行 但 用 VB 脚本更简单
set wscriptObj = CreateObject("Wscript.Shell")
wscriptObj.run "$php_dir$/php-cgi.exe -b 127.0.0.1:9000 -c $ini_dir$/php.ini",0
保存文件后缀 vbs // 参见 http://blog.atimg.com/article/jswz/2308.htm
停止:
@echo off
echo Stopping nginx...
taskkill /F /IM nginx.exe > nul
echo Stopping PHP FastCGI...
taskkill /F /IM php-cgi.exe > nul
exit
号外: 在 Apache 配置文件 中 可使用 PHPIniDir "$ini_dir$/php.ini" 来指定 php的配置文件
另外 遇到一个问题 纠结了很久 : 下载的 php 是 vc9 的,开始总是无法运行php程序,不知道为什么。后来发现是没有运行库,即环境。
下载:
Microsoft 2008 C++ Runtime (x86)
http://www.microsoft.com/downloads/zh-cn/details.aspx?familyid=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=zh-cn
Microsoft 2008 C++ Runtime (x64)
http://www.microsoft.com/downloads/zh-cn/details.aspx?familyid=bd2a6171-e2d6-4230-b809-9a8d7548c1b6&displaylang=zh-cn