windows下ngnix+php配置
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配置的更多相关文章
- Windows下python的配置
Windows下python的配置 希望这是最后一次写关于python的配置博客了,已经被python的安装烦的不行了.一开始我希望安装python.手动配置pip并使用pip安装numpy,然而发现 ...
- Windows 下用 gogs 配置局域网 git server
大道曙光 Windows 下用 gogs 配置局域网 git server 最近要用 C# 开发一个新的项目,所以需要在 Windows 局域网环境下构建一个 git server. 在 Window ...
- Windows 下如何安装配置Snort视频教程
Windows 下如何安装配置Snort视频教程: 第一步: http://www.tudou.com/programs/view/UUbIQCng360/ 第二部: http://www.tudou ...
- PHP学习之-Mongodb在Windows下安装及配置
Mongodb在Windows下安装及配置 1.下载 下载地址:http://www.mongodb.org/ 建议下载zip版本. 2.安装 下载windows版本安装就和普通的软件一样,直接下一步 ...
- Windows下caffe的配置和调用caffe库(一)
一.Windows下caffe的配置: 1. 下载caffe官网提供的开发包,https://github.com/microsoft/caffe 2. 将caffe-master目录下的Window ...
- windows下安装和配置redis
1.windows下安装和配置redis 1.1 下载: 官网(linux下载地址):https://redis.io/ Windows系统下载地址:https://github.com/MSOpen ...
- Windows下为 Eclipse 配置 C/C++ 编译环境(转)
1.Eclipse及CDT的安装 CDT的全称是C/C++ DevelopmentTools,CDT使得Eclipse能够支持C/C++的开发.直接下载 eclipse CDT 集成版 下载地址:ht ...
- windows下安装和配置多个版本的JDK
https://jingyan.baidu.com/article/47a29f2474ba55c015239957.html 如何在windows下安装和配置多个版本的jdk,本文将带你在windo ...
- 网络基础 Windows下安装和配置net-snmp 代理
Windows 下安装和配置net-snmp 代理[摘录] by:授客 QQ:1033553122 A. 安装 1. 安装前准备 ActivePerl-5.10.0.1004-MSWin ...
随机推荐
- vscode git设置远程仓库码云
https://www.cnblogs.com/klsw/p/9080041.html
- layui tips
- Lodop打印控件 打印透明图问题
Lodop通过增设transcolor属性实现了“先字后章”效果,这个属性可以把某种颜色转成类似透明的效果.例如:把图章的底色白色变成透明:transcolor="#FFFFFF" ...
- servlet篇 之 生命周期
二:Servlet的生命周期 背景知识: servlet是单例,在web项目运行期间,一个servlet只会创建一个对象[tomcat帮我们实例 化][尽量不要在servlet中定义成员变量].因为w ...
- python基础数据类型--dict 字典
字典 字典是python中唯一的映射类型,采用键值对(key-value)的形式存储数据.python对key进行哈希函数运算,根据计算的结果决定value的存储地址,所以字典是无序存储的,且key必 ...
- POJ1442-查询第K大-Treap模板题
模板题,以后要学splay,大概看一下treap就好了. #include <cstdio> #include <algorithm> #include <cstring ...
- Aizu2130-Billion Million Thousand-dp
用dp求出最大的表达,再用dp求出.//然而并没有想出来 #include <cstdio> #include <string> #include <algorithm& ...
- C# 动态调用泛型方法
static void Main(string[] args) { #region 具体类型可传递. Personal specifiedPersonal = new Personal(); Empl ...
- 爬虫_拉勾网(selenium)
使用selenium进行翻页获取职位链接,再对链接进行解析 会爬取到部分空列表,感觉是网速太慢了,加了time.sleep()还是会有空列表 from selenium import webdrive ...
- Linux 遍历目录下面所有文件,将目录名、文件名转为小写
当你从 Windows 服务器换到 Linux 服务器的时候,以前的上传目录的目录名.文件名会遇到大小写的问题.在 Windows 环境下面没有文件区分大小写的概念,而 Linux 却有严格的文件名大 ...