Heim  >  Artikel  >  Backend-Entwicklung  >  windows nginx +php 配备

windows nginx +php 配备

WBOY
WBOYOriginal
2016-06-13 11:01:01820Durchsuche

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"> 您还没有登录,请您登录后再发表评论

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn