1、需要工具:

下载ngnix  网址:http://nginx.org/

下载:RunHiddenConsole

第二步 将下载文件解压后,将RunHiddenConsole拷贝到ngnix目录与php所在目录

修改conf目录下ngnix.conf,使其支持php

 site:

 server {
listen ; #端口
server_name example.org www.example.org; #域名
root e:/www; location / {
index index.html index.php;
} location ~* \.(gif|jpg|png)$ {
expires 30d; #缓存图片文件
}
#支持php
location ~ \.php$ {
fastcgi_pass 127.0.0.1:;
fastcgi_param SCRIPT_FILENAME
e:/www$fastcgi_script_name;
include fastcgi_params;
}
}

另外可以把虚拟主机单独出来

在ngnix.conf文件中加入如下代码

http{

#其它代码

include vhost/*.conf; #加载vhost目录下的虚拟主机配置文件 

}

可以在conf文件夹中新建一个vhost文件夹,在此目录下建立新文件自定义文件名,扩展名为conf即可,在文件中加入如下代码

 server {
listen 80;
server_name www.szs.com; #charset koi8-r; #access_log logs/host.access.log main; location / {
root E:/20nc;
index index.php index.html index.htm;
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
#root D:/wamp/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME E:/20nc$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(gif|jpg|png)$ {
expires 30d;
} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}

  

第三步:配置php.ini文件使其支持cgi

;cgi.force_redirect = 1,删除前面的分号:cgi.force_redirect = 1

;cgi.fix_pathinfo=1,删除前面的分号:cgi.fix_pathinfo=1

;cgi.rfc2616_headers = 0,删除前面的分号:cgi.rfc2616_headers = 1

第四步:制作启动和关闭ngnix文件

注意:路径请自行更改

start.bat

@echo off
echo start_nginx.bat
  echo Starting PHP FastCGI...
cd D:/bin/php/php5.5.12
d:
  RunHiddenConsole php-cgi.exe -b 127.0.0.1:9000 -c php.ini
  echo Starting nginx...
cd C:/nginx
c:
  RunHiddenConsole nginx.exe
  Exit exit.bat @echo off
  echo stop_nginx.bat
  echo Stopping nginx...
  taskkill /F /IM nginx.exe > nul
  echo Stopping PHP FastCGI...
  taskkill /F /IM php-cgi.exe > nul
  exit

 

windows下ngnix+php配置的更多相关文章

  1. Windows下python的配置

    Windows下python的配置 希望这是最后一次写关于python的配置博客了,已经被python的安装烦的不行了.一开始我希望安装python.手动配置pip并使用pip安装numpy,然而发现 ...

  2. Windows 下用 gogs 配置局域网 git server

    大道曙光 Windows 下用 gogs 配置局域网 git server 最近要用 C# 开发一个新的项目,所以需要在 Windows 局域网环境下构建一个 git server. 在 Window ...

  3. Windows 下如何安装配置Snort视频教程

    Windows 下如何安装配置Snort视频教程: 第一步: http://www.tudou.com/programs/view/UUbIQCng360/ 第二部: http://www.tudou ...

  4. PHP学习之-Mongodb在Windows下安装及配置

    Mongodb在Windows下安装及配置 1.下载 下载地址:http://www.mongodb.org/ 建议下载zip版本. 2.安装 下载windows版本安装就和普通的软件一样,直接下一步 ...

  5. Windows下caffe的配置和调用caffe库(一)

    一.Windows下caffe的配置: 1. 下载caffe官网提供的开发包,https://github.com/microsoft/caffe 2. 将caffe-master目录下的Window ...

  6. windows下安装和配置redis

    1.windows下安装和配置redis 1.1 下载: 官网(linux下载地址):https://redis.io/ Windows系统下载地址:https://github.com/MSOpen ...

  7. Windows下为 Eclipse 配置 C/C++ 编译环境(转)

    1.Eclipse及CDT的安装 CDT的全称是C/C++ DevelopmentTools,CDT使得Eclipse能够支持C/C++的开发.直接下载 eclipse CDT 集成版 下载地址:ht ...

  8. windows下安装和配置多个版本的JDK

    https://jingyan.baidu.com/article/47a29f2474ba55c015239957.html 如何在windows下安装和配置多个版本的jdk,本文将带你在windo ...

  9. 网络基础 Windows下安装和配置net-snmp 代理

    Windows 下安装和配置net-snmp 代理[摘录] by:授客 QQ:1033553122   A.   安装  1.   安装前准备 ActivePerl-5.10.0.1004-MSWin ...

随机推荐

  1. Ubuntu16.04 启动纯文本界面方法

    问题: Ubuntu16.04 如何启动纯文本界面. 解决方法: 1.系统启动后,在登陆界面点击Ctrl+Shift+F1切换到文本登陆界面: 2.修改为默认从文本界面登陆: sudo vi /etc ...

  2. 百度编辑器UEditor使用方法

    http://www.cnblogs.com/lionden/archive/2012/07/13/ueditor.html 介绍图片上传:http://uikoo9.com/blog/detail/ ...

  3. NetScope脱机(localhost)使用[转】

    https://blog.csdn.net/jiwu999/article/details/79626773 方法: step1:git clone https://github.com/ethere ...

  4. CF980E

    题面 Panel 国将举办名为数字游戏的年度表演.每个省派出一名选手. 国家有 n 个编号从 1 到 n 的省,每个省刚好有一条路径将其与其他省相连.第 i 个省出来的代表有 2^i 名粉丝. 今年, ...

  5. poj-2337(欧拉回路输出)

    题意:给你n个字符串,每个字符串可以和另一个字符串连接的前提是,前一个字符串的尾字符等于后一个字符串的首字符,问你存不存在欧拉通路并输出 解题思路:基本标准流程,建图:把一个字符串可以看作一条首字符指 ...

  6. windows开关机事件

    开关机事件.xml <ViewerConfig> <QueryConfig> <QueryParams> <Simple> <BySource&g ...

  7. 【XSY2714】大佬的难题 数学 树状数组

    题目描述 给你三个排列\(A,B,C\),求 \[ \sum_{1\leq x,y\leq n}[a_x<a_y][b_x<b_y][c_x<c_y] \] \(n\leq 2\ti ...

  8. 【BZOJ3625】【CF438E】小朋友和二叉树 NTT 生成函数 多项式开根 多项式求逆

    题目大意 考虑一个含有\(n\)个互异正整数的序列\(c_1,c_2,\ldots ,c_n\).如果一棵带点权的有根二叉树满足其所有顶点的权值都在集合\(\{c_1,c_2,\ldots ,c_n\ ...

  9. PHP获取网络图片并保存在本地目录

    PHP获取网络图片并保存在本地目录思路: 代码如下: function file_exists_S3($url) { $state = @file_get_contents($url,0,null,0 ...

  10. NORMA2 - Norma [cdq分治]

    题面 洛谷 你有一个长度为n的序列,定义这个序列中每个区间的价值是 \(Cost(i,j)=Min(Ai...Aj)∗Max(Ai...Aj)∗(j−i+1)Cost(i,j)=Min(A_{i}.. ...