Nginx for Windows安装配置之解压缩版

Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。2011年6月1日,nginx 1.0.4发布。

Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行。由俄罗斯的程序设计师Igor Sysoev所开发,供俄国大型的入口网站及搜索引擎Rambler(俄文:Рамблер)使用。其特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:新浪、网易、腾讯等。

一、下载

下载地址:

http://nginx.org/download/nginx-1.9.0.zip

二、配置

2.1 下载下来的zip后缀的程序包,解压出来,然后自定义名称放在相应的位置上,我是在服务器的D盘根目录下,命名为:nginx,即D:\nginx\ ,该目录下包含logs、conf、docs、html等目录及文件;

2.2 配置nginx.conf

编辑根程序目录下conf/nginx.conf的文件里面的内容,内容类似如下:

#user  nobody;
worker_processes  2;

#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;

location / {
            root   html;
            index  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           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

location = /nginx_check.html {
            stub_status on;
            access_log off;
            proxy_redirect off;
   }
        # 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 ssl;
    #    server_name  localhost;

#    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

#    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

#    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

#    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

2.3 启动脚本

@echo off
REM Windows 下无效
REM set PHP_FCGI_CHILDREN=5

REM 每个进程处理的最大请求数,或设置为 Windows 环境变量
set PHP_FCGI_MAX_REQUESTS=1000

echo Starting PHP FastCGI...
RunHiddenConsole D:/php/php-cgi.exe -b 127.0.0.1:9000 -c D:/php/php.ini

echo Starting nginx...
D:/nginx/nginx.exe
exit

2.4 关闭脚本

@echo off
echo Stopping nginx...
taskkill /F /IM nginx.exe > nul
echo Stopping PHP FastCGI...
taskkill /F /IM php-cgi.exe > nul
exit

注:RunHiddenConsole需要另外下载;PHP安装配置请参照本BLOG文章,链接如下:

http://63638790.blog.51cto.com/513514/1650975

时间: 2024-07-29 14:20:51

Nginx for Windows安装配置之解压缩版的相关文章

Apache for windows安装配置之解压缩版

Apache HTTP Server是Apache软件基金会的一个开放源码的网页服务器,可以在大多数计算机操作系统中运行,由于其多平台和安全性被广泛使用,是最流行的Web服务器端软件之一.它快速.可靠并且可通过简单的API扩展,将Perl/Python等解释器编译到服务器中. 一.下载 下载地址:http://www.apachehaus.com/cgi-bin/download.plx 二.配置 2.1 下载下来的zip后缀的程序包,解压出来,然后自定义名称放在相应的位置上,我是在服务器的D盘

Nginx介绍及安装配置

Nginx介绍 如果听说过Apache软件那么对于Nginx也会很快就熟悉的和Apache一样nginx是开源的支持高性能高并发的WWW服务.代理服务软件以及电子邮件代理服务器并在一个BSD-like协议下发行由俄罗斯Igor Sysoev所开发开始供俄国大型的入口网址及搜索引擎Rambler使用. nginx占有内存小并发能力强特别是静态资源且功能丰富而流行起来. 从软件的功能应用方面Nginx不但是一个优秀的Web服务软件还可以具有反向代理负载均衡能和缓存服务功能.代理方面类似专业的LVS负

nginx for windows 安装

一.nginx for windows 的安装地址: http://nginx.org/en/download.html 二.nginx 安装地址: http://nginx.org/en/docs/windows.html 三.开始安装 1.将下载的nginx的文件解压 nginx的目录结构:conf:配置文件 html:默认的资源文件 log:访问日志和错误日志 2.打开dos命令,找到nginx的文件夹下,启动nginx 如果有报错,可以查看log日志里面的error.log文件 3.查看

企业实战nginx动静分离安装配置

Nginx Web服务器目前在IT企业中应用最广泛,为什么它会如此让人热爱呢,因为它的高性能.稳定性,而且越来越发展,那Nginx在企业中是如何来应用的呢?Nginx动静分离是如何来配置的呢,今天我们将跟大家一起来构建一个Nginx动静分离的架构. 一.实践环境: 系统版本:CentOS6.0 X86_64 Nginx版本:Nginx-1.2.6 Tomcat版本:Tomcat-6.0.18 二.Nginx安装: 实际环境中安装Nginx,首先需要安装pcre库,然后再安装Nginx: #安装p

Windows安装配置php+memcached的方法

Windows下Memcached的安装配置方法 1.将第一个包解压放某个盘下面,比如在c:\memcached. 2.在终端(也即cmd命令界面)下输入 'c:\memcached\memcached.exe -d install' 安装. 3.再输入: 'c:\memcached\memcached.exe -d start' 启动.(需要注意的: 以后memcached将作为windows的一个服务每次开机时自动启动.这样服务器端已经安装完毕了). 4.下载php_memcache.dll

Centos6.5 + Nginx +mysql + php 安装配置文档

一.安装环境准备 yum -y install vim lrzsz 上传mysql.nginx.php安装包 (1)Nginx的下载地址: http://nginx.org/en/download.html (2)PHP安装包的下载 http://php.net/downloads.php        (3)MySQL的下载 https://www.mysql.com/downloads/             (4)安装包上传到服务器 /usr/local/src文件夹目录下: mkdir

NGINX源码安装配置详解(./configure),最全解析

NGINX ./configure详解 在"./configure"配置中,"--with"表示启用模块,也就是说这些模块在编译时不会自动构建"--without"表示禁用模块,也就是说这些模块在编译时会自动构建,若你想Nginx轻量级运行,可以去除一些不必要的模块. [[email protected] nginx-1.14.0]# ./configure --help => 查看安装配置项 --help 打印帮助信息. --prefix

nginx 服务器下载安装配置详解

近段时间用了nginx服务  作为总结写一篇博客 与大家分享:时间关系没有说的太过于详细甚至言语有些凌乱望见谅,有不足之处请斧正. 有这几个问题 与大家探讨一下 1 nginx是个什么东东?2为什吗要用nginx 3 如何用? 首先nginx和apache一样是一个web服务器.apache大家都知道 年代久远 世界第一大服务器.它是一个重量级服务器,不支持高迸发.运行数以万计的迸发访问,会导致apache消耗大量的内存,导致http请求响应效率降低,影响用户的体验. nginx的出现就是为了应

windows 安装配置Apache2.4.7

一.安装配置Apache2.4.7(httpd-2.4.7-win64-VC11.zip ) 1.解压下载的安装包:httpd-2.4.7-win64-VC11.zip将其放到自己的安装目录(我的目录D:\phpEnv\Apache24) 2 2.然后对http.conf(D:\phpEnv\Apache24\conf\http.conf)配置文件进行修改-使用记事本打开就行 (1)修改ServerRoot Apache的根路径: (37行)ServerRoot"c:/Apache24"