windows nginx +php 配备

WBOY
Release: 2016-06-13 13:03:49
Original
807 people have browsed it

windows nginx +php 配置

在windows下进行nginx +php的配置比较简单:

1、首先下载安装php,版本至少要在5.0以上(主要是要PHP版本支持FastCgi方式,包含有php-cgi.exe即可 ),修改php.ini配置文件

enable_dl = On
cgi.force_redirect = 0
cgi.fix_pathinfo=1
fastcgi.impersonate = 1
cgi.rfc2616_headers = 1

rror_reporting = E_ALL
display_errors = On
extension_dir = "C:\php\ext"
; 动态扩展,可以根据需要去掉 extension 前面的注释 ;?
; 如加载 PDO, MySQL
extension=php_pdo.dll
extension=php_pdo_mysql.dll

2、Nginx配置PHP是以FastCgi方式配置的

3、用文本编辑功能根据打开E:\nginx1.0\conf 目录下的nginx.conf,找到

?

?

?? ? ? ?location / {

?? ? ? ? ? ?root ??html;

?? ? ? ? ? ?index ?index.html index.htm;

?? ? ? ?}

修改为

?

?

?? ? ? ?location / {

?? ? ? ? ? ?root ??D:/PHPWeb;

?? ? ? ? ? ?index ?index.php index.html index.htm;

?? ? ? ?}

找到

?

# 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 ?/scripts$fastcgi_script_name;

?? ? ? ?# ? ?include ? ? ? ?fastcgi_params;

?? ? ? ?#}

修改为

?

# 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? D:/PHPWeb$fastcgi_script_name;

?? ? ? ? ? ?include ? ? ? ?fastcgi_params;

?? ? ? ?}

4、启动fast-cgi

?找到php的安装目录,在控制台输入以下命令

f:/php/php-cgi.exe -b 127.0.0.1:9000 -c f:/php/php.ini

5、找到nginx的安装目录,启动nginx

或者建立batlogin"> 您还没有登录,请您登录后再发表评论

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!