Windows系统下Nginx服务器的基本安装和配置方法介绍_nginx

下载地址:http://nginx.org/download/nginx-1.2.4.zip
下载后直接解压到你的硬盘上,我的是d:\nginx
启动nginx

cd d:
cd nginx-1.2.4
start nginx

查看任务任务管理器里面会有nginx的进程
在浏览器输入http://127.0.0.1 此时会出现nginx的欢迎界面,说明启动nginx成功。

Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.

其他操作:

nginx -s stop     // 停止nginx
nginx -s reload    // 重新加载配置文件
nginx -s quit     // 退出nginx

配置文件:

#user nobody;
worker_processes 1;#启动的线程数:一本内核的数目*2
#错误的位置和级别
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; 

#pid    logs/nginx.pid;#pid进程文件的位置 

events {
  worker_connections 1024;#每个进程的最大连接数
} 

http {
  include    mime.types;
  default_type application/octet-stream;
  #nginx日志格式定义,在下面可以进行引用
  #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;开启gzip压缩
  #server为设置的虚拟机,可以设多个
  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 /scripts$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 HIGH:!aNULL:!MD5;
  #  ssl_prefer_server_ciphers  on; 

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

}

小提示:
  运行nginx -V可以查看该平台编译版支持哪些模块。我这里的结果为:

nginx version: nginx/0.7.65
  TLS SNI support enabled
  configure arguments:
  --builddir=objs.msvc8
  --crossbuild=win32
  --with-debug --prefix=
  --conf-path=conf/nginx.conf
  --pid-path=logs/nginx.pid
  --http-log-path=logs/access.log
  --error-log-path=logs/error.log
  --sbin-path=nginx.exe
  --http-client-body-temp-path=temp/client_body_temp
  --http-proxy-temp-path=temp/proxy_temp
  --http-fastcgi-temp-path=temp/fastcgi_temp
  --with-cc-opt=-DFD_SETSIZE=1024
  --with-pcre=objs.msvc8/lib/pcre-7.9
  --with-openssl=objs.msvc8/lib/openssl-0.9.8k
  --with-openssl-opt=enable-tlsext
  --with-zlib=objs.msvc8/lib/zlib-1.2.3
  --with-select_module
  --with-http_ssl_module
  --with-http_realip_module
  --with-http_addition_module
  --with-http_sub_module
  --with-http_dav_module
  --with-http_stub_status_module
  --with-http_flv_module
  --with-http_gzip_static_module
  --with-http_random_index_module
  --with-http_secure_link_module
  --with-mail
  --with-mail_ssl_module
  --with-ipv6
  
  nginx version: nginx/0.7.65
  TLS SNI support enabled
  configure arguments:
  --builddir=objs.msvc8
  --crossbuild=win32
  --with-debug --prefix=
  --conf-path=conf/nginx.conf
  --pid-path=logs/nginx.pid
  --http-log-path=logs/access.log
  --error-log-path=logs/error.log
  --sbin-path=nginx.exe
  --http-client-body-temp-path=temp/client_body_temp
  --http-proxy-temp-path=temp/proxy_temp
  --http-fastcgi-temp-path=temp/fastcgi_temp
  --with-cc-opt=-DFD_SETSIZE=1024
  --with-pcre=objs.msvc8/lib/pcre-7.9
  --with-openssl=objs.msvc8/lib/openssl-0.9.8k
  --with-openssl-opt=enable-tlsext
  --with-zlib=objs.msvc8/lib/zlib-1.2.3
  --with-select_module
  --with-http_ssl_module
  --with-http_realip_module
  --with-http_addition_module
  --with-http_sub_module
  --with-http_dav_module
  --with-http_stub_status_module
  --with-http_flv_module
  --with-http_gzip_static_module
  --with-http_random_index_module
  --with-http_secure_link_module
  --with-mail
  --with-mail_ssl_module
  --with-ipv6

查看nginx进程

  tasklist /fi "imagename eq nginx.exe"

如下显示:

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索windows
, nginx
, 配置
nginx配置
nginx服务器 windows、服务器基本系统设备、windows服务器系统、服务器是windows系统、windows系统基本操作,以便于您获取更多的相关知识。

时间: 2024-08-31 19:14:33

Windows系统下Nginx服务器的基本安装和配置方法介绍_nginx的相关文章

Nginx服务器的反向代理proxy_pass配置方法讲解_nginx

就普通的反向代理来讲 Nginx的配置还是比较简单的,如: location ~ /* { proxy_pass http://127.0.0.1:8008; } 或者可以 location / { proxy_pass http://127.0.0.1:8008; } Apache2的反向代理的配置是: ProxyPass /ysz/ http://localhost:8080/ 然而,如果要配置一个相对复杂的反向代理 Nginx相对Apache2就要麻烦一些了 比如,将url中以/wap/开

自动化Nginx服务器的反向代理的配置方法

  这篇文章主要介绍了自动化Nginx服务器的反向代理的配置方法,反向代理是Nginx服务器的招牌功能,需要的朋友可以参考下 如果可以减少过多的外部隔离的API和简化部署的细节 这会是非常好的. 在以前的文章中,我解释了"一些使用反向代理的好处".在我目前的项目里,我们已经构建分布式面向服务的架构,也显式提供了一个HTTP API,我们使用反向代理将请求路由通过API路由给单个组件.我们选择了Nginx Web这个优秀的服务器作为我们的反向代理,它快速.可靠且易于配置.我们通过它将多个

Windows系统下Apache服务器无法启动的问题解决_Linux

关于apache无法启动主要是80端口的问题,下面我们来看一下关于端口被占的处理办法 解决方案:1:在dos下运行netstat -ano 2:在xampp control panel中点setup打开命令界面, 3:选择6 enable mob_perl 4:重新启动xampp,此时运行http://localhost就应该正常工作了 第三种情况是网上一些网友遇到的问题: 与端口绑定时出现问题,未绑定到需要的端口 这是你可以根据error.log中的提示,退出占用端口的程序,这样应该能启用ap

Linux系统下使用mail发送Internet邮件的配置方法

  用惯了windows系统的用户可能一开始对linux系统掌握不好,很多功能可能用起来不是很习惯.本文就介绍了linux系统的一个小应用:在Linux系统下使用mail发送Internet邮件.不过在介绍mail之前先来看一下先来看一下sendmail服务. Red Hat上sendmail服务一般是自动启动的.可以通过下面的命令查看sendmail服务的状态: service sendmail status 如果sendmail服务未启动可以使用如下命令启动: service sendmai

Nginx服务器限制访问速度的配置方法_nginx

用Nginx建站的同学,常会有限速需求.开发测试阶段在本地限速模拟公网的环境,方便调试.投入运营会有限制附件下限速度,限制每个用户的访问速度,限制每个IP的链接速度等需求. 刚遇到一个Bug在网络很卡的情况下才能重现,本地调试访问本机速度太快,配置Nginx成功达到限速目的,在此分享出来. 配置简单,只需3行,打开"nginx根目录/conf/nginx.conf"配置文件修改如下: http{ -- limit_zone one $binary_remote_addr 10m; --

Linux下Nginx+Tomcat整合的安装与配置

一.安装Tomcat和JDK 1.上传apache-tomcat-6.0.18.tar.gz和jdk-6u12-linux-i586.bin至/usr/local2.执行如下命令安装tomcat: #cd /usr/local #tar zxvf apache-tomcat-6.0.18.tar.gz   解压完成后将apache-tomcat-6.0.18重命名为tomcat3.执行如下命令安装JDK: #./jdk-6u12-linux-i586.bin   4.配置环境变量:编辑/etc下

详解Nginx服务器中map模块的配置与使用_nginx

map指令使用ngx_http_map_module模块提供的.默认情况下,nginx有加载这个模块,除非人为的 --without-http_map_module. ngx_http_map_module模块可以创建变量,这些变量的值与另外的变量值相关联.允许分类或者同时映射多个值到多个不同值并储存到一个变量中,map指令用来创建变量,但是仅在变量被接受的时候执行视图映射操作,对于处理没有引用变量的请求时,这个模块并没有性能上的缺失.一. ngx_http_map_module模块指令说明ma

PHP Opcache安装和配置方法介绍

  本文针对PHP5.5等高级版本,编译时需要加上--enable-opcache参数 编译安装完成后,我们开始配置Opcache   代码如下: [Opcache] zend_extension = opcache.so opcache.enable=1 opcache.memory_consumption = 64 opcache.interned_strings_buffer = 8 opcache.max_accelerated_files = 4000 opcache.revalida

PHP Opcache安装和配置方法介绍_php实例

本文针对PHP5.5等高级版本,编译时需要加上--enable-opcache参数 编译安装完成后,我们开始配置Opcache 复制代码 代码如下: [Opcache] zend_extension = opcache.so opcache.enable=1 opcache.memory_consumption = 64 opcache.interned_strings_buffer = 8 opcache.max_accelerated_files = 4000 opcache.revalid