nginx 1.7.7, windows 8.1 x64
官网: http://nginx.org/ 官方文档: http://nginx.org/en/docs/
再加一个,搜索时看到还不错的网站 http://www.nginx.cn/
nginx [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server, written by Igor Sysoev.
windows 直接下载,解压 即可运行。
解压之后
D:\NGINX
├─ nginx.exe # 貌似windows tree 不显示文件
├─conf
├─contrib
│ ├─unicode2nginx
│ └─vim
│ ├─ftdetect
│ ├─indent
│ └─syntax
├─docs
├─html
├─logs
└─temp
├─client_body_temp
├─fastcgi_temp
├─proxy_temp
├─scgi_temp
└─uwsgi_temp
然后在cmd或PowerShell(最好在cmd中)中,切换到相应的根目录。也一定不要在path 中添加nginx.exe 。否则可能会造成你在其它位置启动nginx,但是nginx会在当前目录下面寻找 conf配置文件夹以及配置文件。所以最好的办法就是,直接切换到相应目录。
基本命令:
> start nginx #启动nginx
> nginx.exe -s stop # 停止服务
> nginx.exe -s quit # 中止服务
> nginx.exe -s reload # 重新载入
# 其他
> nginx -v # 显示版本信息
> nginx -V # 显示版本及配置信息
正常情况下,启动完 nginx 之后,就能在进程中看到 2个 nginx 进程。访问 127.0.0.1(localhost) 即可看到 nginx 欢迎界面。
再来个超级简单的windows shell 脚本。
# 保存在任意位置即可,名字为 nginx_start.bat
D:
CD D:/nginx
start nginx.exe
# 第一行 , 从任意盘符切换到 nginx 文件夹所在的盘符
# 切换到 nginx 的根目录
# 开启 nginx 服务
# 最后一行,可以修改为其他 nginx -s reload 来重新载入配置文件
# 这样,修改完配置文件。双击下 nginx_reload.bat 就可以了。
# 好方便的感觉
# 看来,有机会还是要 换到非windows环境,来学习学习bash 脚本了