第一步 下载nginx ,windows版本,解压保存在D:/nginx-1.0.4下( 用的1.0.4版)
第二步 下载 php fast-cgi版本(我用的是 VC9 x86 Non Thread Safe),解压到D:/php-5.3.3下
第三步 把D:/php-5.3.3./php.ini-development重命名成D:/php-5.3.3/php.ini,找到#cgi.fix_pathinfo=1,把#号去掉
第四步 修改D:/nginx-1.0.4/conf/nginx.conf
下面是我的简单配置:
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
#增加负载配置,单机以不同端口方式配置
upstream localhost {
server 127.0.0.1:8080 weight=2;
server 127.0.0.1:8081 weight=1;
}
location / {
#root html; //此处为默认路径
root D:/PHPWeb; //此处为我修改,要运行PHP程序的路径
index index.php index.html index.htm; //增加了 index.php
#以下配置为服务器负载时进行的配置
proxy_pass http://localhost;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#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$ {
# root php;
#index index.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:/PHPWeb; //运行的PHP程序路径
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php; //默认首页程序
#$document_root 指的是上面的 D:/PHPWeb
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
第五步、PHP以fast-cgi形式运行
启动PHP fastcgi执行环境,我们编写bat文件来启动Nginx和PHP的fastcgi
新建记事本,写入如下内容:
@echo off
start D:\php-5.3.3\php-cgi.exe -b 127.0.0.1:9000 -c D:\php-5.3.3\php.ini
start D:\nginx-1.0.4\nginx.exe
将此记事本改名为test.bat;
双击bat文件,即可启动Nginx和PHP的fastcgi
分享到:
相关推荐
1、安装NGINX for win 2. 2、安装PHP for win 3. 3、安装MYSQL for win 1. 4、安装PHPADMIN nginx Logo 下载最新的稳定的nginx的版本 。 nginx的配置和运行 将Nginx配置成WINDOWS服务: 下载WINSW, 建立 ...
::nginx windows服务安装管理器 ::用windows服务安装器winsw把nginx安装为系统服务后,此时重新加载配置reload操作会出错,并不能直接管理,要用system用户身份管理,通过psexec可以达到这一目的 ::通过本管理器可以...
此文档详细介绍了Windows下Nginx的安装与配置,可以让用户在最短的时间内完全配置好nginx!
Nginx 安装成Windows 服务方法
windows 下安装配置 Nginx 详解 - CSDN博客装配置 Nginx 详解阅读数:4348装配置 Nginx 详解本地服务器,通过配置server_
Nginx 1.22.0 Windows版本,解压安装。 Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,在BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力在同...
1.目前官方 Nginx 并不支持Windows,您只能在包括Linux,UNIX,BSD系统下安装和使用,现在提供nginx for windows下载以及详细安装与配置,供windows下的nginx应用。 2.Nginx 本身只是一个HTTP和反向代理服务器,它无法...
windows 下nginx 日志切割 结合windows任务计划,实现每天备份日志,并reopen nginx
nginx for windows详细的安装教程请登录 http://www.bywei.cn/blog/view.asp?id=104 内容导航: (1)nginx的特性和简介 (2)nginx for windows的下载与安装 (3)nginx处理静态资源的配置 (4)nginx 反向代理设置 (5)...
教你怎样使在windows下安装Nginx。
windows 下nginx和php 安装配置,可以学习安装步骤和配置信息
Windows下Nginx配置SSL实现Https访问(包含证书生成)
1、windows 环境下 nginx安装压缩包。 2、nginx.conf配置文件中有相关配置的注解说明,方便上手配置。 3、nginx.conf配置文件中的 域名 是通过 在hosts文件中添加 IP 和自定义域名的映射后配置的。
nginx windows最新版 nginx windows最新版 nginx windows最新版
windows版nginx安装包,nginx 1.11.9.1 Lion.zip,欢迎下载
windows Nginx压缩包
Windows下编译Nginx并添加模块,在项目中使用过的
Nginx在Window下安装实现微信公众号反向代理配置
nginxWindows版,自带rtmp服务模块,需要放在c盘根目录下面使用。
包含upload-module的nginx-1.21.6,针对windows平台64位的编译的二进制(exe)文件。 为了upload-module能在window平台编译通过,进行部分代码修改,修改内容详见https://github.com/chnykn/bimface