location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
1.配置nginx
只需修改一行(nginx/conf/nginx.conf)
fastcgi_param SCRIPT_FILENAME 文档存放目录/$fastcgi_script_name;
找到大概这一行修改路径最好是绝对路径(相对路径可以自行探讨)
2.运行软件
先运行php
程序》运行》cmd
到php所在目录运行下面代码
注意:php-cgi.exe -b 127.0.0.1:9000 -c php\php.ini
再运行nginx
到nginx所在目录
nginx.exe -c conf\nginx.conf