nginx 基础(windows)

1.安装

以服务方式运行,下载srvany.exe,instsrv.exe文件放在nginx安装目录 

运行命令instsrv Nginxc:/nginx/srvany.exe ,这样就安装了一个Nginx的服务

配置Nginx的运行参数

可以直接将配置导入到注册表

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NGINX\Parameters]
"Application"="D:\\nginx-1.2.7\\nginx.exe"
"AppParameters"=""
"AppDirectory"="D:\\nginx-1.2.7\\"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NGINX]
"Description"="NGINX WEB 服务器"

  当停止Nginix服务后,访问浏览器仍然能看到网站。查看进程,你会发现,Nginx启动了两个nginx进程(根据nginx.conf的配置worker_processes 1;),Fork出来的进程显然没有被停止,结果就是nginx永远关不掉。写一个stop_nginx脚本来处理nginx停止的所有操作 

Command代码@echo off   
echo Stopping nginx service... 
net stop nginx   
echo Kill nginx process...   

taskkill /F /IM nginx.exe > nul

删除服务,使用命令: 

sc delete Nginx

 测试配置是否正常

 nginx -t 

posted on 2013-03-14 11:19  落叶常青  阅读(175)  评论(0编辑  收藏  举报

导航