nginx 简单使用

一,下载

http://nginx.org/en/download.html

这个是我下载的windows版本

nginx 简单使用_第1张图片

二,解压后目录

nginx 简单使用_第2张图片

 

三,修改配置文件

(由于80端口很可能被 SQL Server Reporting Service 占用了,所以我们修改一下)

打开conf文件夹中的nginx.conf文件

nginx 简单使用_第3张图片

upstream test中配置了站点的服务器。

listen改成8001,这个是nginx的启动端口

location中配置了就是  http://test;     (test就是上面的upstream test)

 

四,启动nginx

直接目录下 cmd运行,nginx.exe

退出时,切记去任务管理器查看一下,有的话手动结束,不然配置文件不更新。

下面是常用命令。

nginx -s quit         退出nginx  
nginx -s reload     重启并载入nginx.conf
nginx -s reopen     打开日志
nginx -v            版本  
nginx -t            检查nginx.conf
nginx -h            帮助

 

五,测试

我访问了  http://localhost:8001/test/test.do

看一下结果,说明是轮流访问的。

nginx 简单使用_第4张图片

nginx 简单使用_第5张图片

你可能感兴趣的:(nginx 简单使用)