windows下nginx反向代理

--nginx安装目录下做cmd启动程序nginx-start.cmd,打开web:http://localhost:8082/
start "nginx" cmd /k nginx.exe -c conf\nginx_upstream.conf

#做一个文件C:\nginx-1.16.1\conf\nginx_upstream.conf,配置如下

# 简单指令以;结尾
worker_processes  1;

# 大括号属于块指令
events {
    worker_connections  1024;
}

# http属于主上下文
http {
    include       mime.types;
    default_type  text/html;

    sendfile        on;

    keepalive_timeout  65;

    upstream backend {
        server 127.0.0.1:8080;
        server 127.0.0.1:8081;
    }

    # server在http的上下文中 
    server {
        listen 8082;
        # location在server上下文中
        location / {
            proxy_pass http://backend;
        }
    }

}
  

 

 

posted @ 2020-04-06 21:33  virtual_daemon  阅读(322)  评论(0编辑  收藏  举报