Home >Backend Development >PHP Tutorial >Windows 下 Nginx + PHP 配置

Windows 下 Nginx + PHP 配置

WBOY
WBOYOriginal
2016-06-23 14:33:221097browse

先确认你的PHP5 里是否有php-cgi.exe 没有的话重新去下载版本..本文以php 5.2.8 为例

1.打开php.ini

查找定位至:;cgi.force_redirect = 1,将前面的分号去掉为:cgi.force_redirect = 1

查找定位至:;cgi.fix_pathinfo=1,将前面的分号去掉为:cgi.fix_pathinfo=1

查找定位至:;cgi.rfc2616_headers = 0,将前面的分号去掉为:cgi.rfc2616_headers = 1

2.打开nginx.conf [本文以1.3为例] 

location ~ \.php$ {
  root html;
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
 #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;#使用这个不会出现 NGINX PHP No input file specifiedinclude              fastcgi_params;

}

以上两部配置完成php+nginx

打开服务

1.在cmd下启动php-cgi

  F:/PHP/php-5.2.8-Win32/php-cgi.exe -b 127.0.0.1:9000 -c F:/PHP/php-5.2.8-Win32/php.ini

2.打开nginx.exe 即可支持php

End..............

 

批处理打开服务

建立一个*.bat文件存入

  F:/PHP/php-5.2.8-Win32/php-cgi.exe -b 127.0.0.1:9000 -c F:/PHP/php-5.2.8-Win32/php.ini

  

  cd F:/PHP/nginx-1.3.0/
  F:
  nginx.exe

 

关闭服务批处理

  taskkill /F /IM nginx.exe

  taskkill /F /IM php-cgi.exe

 

 

 

 

 

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn