Nginx +php (Windows)

参考 网上 配了 下 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

 





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值