1,从nginx官网下载相应的安装包:http://nginx.org/ (我下载版本nginx-1.12.2)
2,将下载文件解压到D:\dev
3,启动nginx
常用命令:
start nginx.ext 启动
nginx.exe -s stop 停止
nginx.exe -s reload 重新加载
nginx.exe -s quit 退出
nginx.exe -s stop 关闭
tasklist|findstr nginx 查看进程
tskill nginx 杀进程
1,打开nginx的conf配置文件
2,增加如下配置
server { listen 80; server_name localhost 127.0.0.1; location / { autoindex on; root D:/dev; } } upstream app-coupon-luck{ server 10.10.11.166:8091 weight=5; } server { listen 9000; server_name localhost 127.0.0.1; location / { root html; proxy_pass http://app-coupon-luck; } }
说明:第一server配置浏览器访问D:/dev目录,第二个server配置localhost:9000代理10.10.11.166:8091服务器