自己记录一下,备忘
下载Nginx for Windows
打开网址
http://nginx.org/en/download.html
其中 nginx/Windows-1.10.1 是直接下载编译好的Windows版本的二进制程序
下载PHP for Windows
http://windows.php.net/download
我下载的是 PHP5, 版本是 PHP 5.6 (5.6.24) VC11 x86 Non Thread Safe (2016-Jul-21 19:18:58)
解压到本地某个目录
修改 Nginx 配置 /conf/nginx.conf 文件
1. 文档位置
location /{
root html # 是指相对目录 html 这个文件夹
index index.html index.htm index.php;} # 默认首页
2. php支持
location ~ .php{
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAMEdocument_root$fastcgi_script_name;
include fastcgi_params;
}
PHP 配置略…
启动命令:
先启动 php-cgi
E:\Software\nginx-1.10.1\fast-cgi\php-5.6.24-nts-Win32-VC11-x86>php-cgi.exe -b 1
27.0.0.1:9000 -c E:\Software\nginx-1.10.1\fast-cgi\php-5.6.24-nts-Win32-VC11-x86
\php.ini
再启动 nginx
E:\Software\nginx-1.10.1>nginx.exe
关闭
先关 nginx
taskkill /F /IM nginx.exe > nul
再关 php-cgi
taskkill /F /IM php-cgi.exe > nul