nginx php 配置

时间:2021-04-11 10:56:11

nginx php 环境的搭建步骤:

1.nginx 配置:

server {

listen       4446;

server_name  localhost;

location / {

root    C:/htdocs/first/public/;

index  index.php index.htm ;

}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

location ~ \.php$ {

root           C:/htdocs/first/public/;

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

include        fastcgi_params;

}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

#location ~ /\.ht {

#    deny  all;

}

}

2. php.ini 文件的配置

;cgi.fix_pathinfo=1去掉;

3.启动 php-cgi.exe

使用php-cgi.exe -b 127.0.0.1:9000

以上就是配置文件的设置。