win7 + nginx + php

1. 下载

Nginx的下载地址:http://www.nginx.org/

PHP的下载地址:http://www.php.NET/downloads.php

 win7 64  +  php-5.4.8-Win32-VC9-x86  +  nginx-1.2.4

2. Windows平台下的nginx、php的安装配置。

  • 2.1 解压下载的nginx和php的压缩包。
  • 2.2 修改nginx/conf/nginx.conf文件中对应的php配置部分,如下:
            # 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  $document_root$fastcgi_script_name;  
                include        fastcgi_params;  
                include        fastcgi.php.conf;  
            }  

 

特别需要注意的是:fastcgi_param这个参数默认的是$fastcgi_script_name;**最好改为$document_root$fastcgi_script_name;  我**在实际配置中出现了php找不到需要解析文件而返回404或者500错误的问题。所以最好是带上网站根目录的路径变量$document_root。

 

  • 2.3 运行nginx:

D:/www/nginx-0.7.61>start nginx.exe

以start的方式运行,nginx不需要一直占有cmd窗口,这样方便之后调试时,随时重载配置文件。

 

  • 2.4 运行php_cgi:

D:/www/php>php-cgi -b 127.0.0.1:9000

  • 2.5 测试是否安装成功

在nginx/html下面,新建一个phpinfo.php文件,写一个phpinfo的测试文件:

  1. <?php  
  2. phpinfo();  
  3. ?>  

尝试访问http://127.0.0.1:端口号/phpinfo.php,如果看到了php的相关信息,那么就说明配置成功了。

 如果有报报错,error: Call to undefined function mb_convert_encoding()

  如果有UTF-8问题, 1、添加文件 c:/php/ext/php-mbstrings.dll   2、在php.ini文件中取消extension=php_mbstring.dll的注释

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值