侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

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

Windows  /  管理员 发布于 5年前   220

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

cd d:cd nginx-1.2.4start 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     // 停止nginxnginx -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"

如下显示:



  • 上一条:
    win8将小工具添加到桌面方法介绍
    下一条:
    Linux中mkdir函数与Windows中_mkdir函数的区别
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • Windows 10的告别:2025年10月14日,一段时代的终结(0个评论)
    • windows 11激活_Win11 KMS激活流程步骤(1个评论)
    • 安装Windows 11系统的注意了,看看你的cpu是否在微软兼容列表排除中(1个评论)
    • 微软将于2022年9月20日推送Windows11 22H2新版本,推测2024发布windows 12(0个评论)
    • windows11系统中可以关闭禁止的服务及介绍(1个评论)
    • 近期文章
    • 智能合约Solidity学习CryptoZombie二课:让你的僵尸猎食(0个评论)
    • 智能合约Solidity学习CryptoZombie第一课:生成一只你的僵尸(0个评论)
    • 在go中实现一个常用的先进先出的缓存淘汰算法示例代码(0个评论)
    • 在go+gin中使用"github.com/skip2/go-qrcode"实现url转二维码功能(0个评论)
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 欧盟关于强迫劳动的规定的官方举报渠道及官方举报网站(0个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf文件功能(0个评论)
    • Laravel从Accel获得5700万美元A轮融资(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2018-01
    • 2018-06
    • 2020-06
    • 2021-06
    • 2021-07
    • 2022-01
    • 2022-04
    • 2022-08
    • 2023-08
    • 2023-10
    • 2024-04
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客