---
title: "Windows下Nginx+PHP5(FastCgi)配置+MySQL5"
author: "cjx186"
date: "2012-10-31T22:42:10Z"
tags: []
categories: ["非技术"]
slug: "windows-nginx-php5-fastcgi-mysql5"
draft: false
lastmod: "2012-10-31T22:42:10Z"
id: 1709855
url: "https://xml.iteye.com/blog/1709855"
---

1.下载软件
Nginx 下载地址：<http://nginx.org/download/nginx-0.8.17.zip>
PHP 下载地址：<http://windows.php.net/downloads/releases/archives/php-5.3.3-Win32-VC6-x86.zip>
MySQL 下载地址：<http://downloads.mysql.com/archives/mysql-5.0/mysql-noinstall-5.0.20-win32.zip>
2.配置Nginx主要是nginx.conf文件
```更改目录
location / {
    #root   html;
    #index  index.html index.htm;
    root d:/web;
    index  index.html index.htm index.php;
}
```

把
```java
#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;
#}
```
去处#并添加WEB目录
```java
location ~ \.php$ {
    root           d:/web;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  d:/web$fastcgi_script_name;
    include        fastcgi_params;
}
```

修改PHP.INI配置文件
```PHP.INI
cgi.fix_pathinfo = 1
```

启动PHP FastCgi，在CMD模式下输入

```java
RunHiddenConsole D:/dev/php-5.3.3/php-cgi.exe -b 127.0.0.1:9000 -c D:/dev/php-5.3.3/php.ini

```

启动Nginx服务,即在CMD模式下输入
```java
X:/nginx-0.8.17/nginx.exe
```