Nginx是一个高性能的HTTP和反向代理的web服务器
配置文件:nginx.conf
1 |
|
1 |
|
cd /usr/local/nginx/sbin/
./nginx 启动
./nginx -s stop 停止
./nginx -s quit 安全退出
./nginx -s reload 重新加载配置文件
ps aux|grep nginx 查看nginx进程
1 |
|
upstream lb{
server 127.0.0.1:8080 weight=1;
server 127.0.0.1:8081 weight=1;
}
location / {
proxy_pass http://lb;
}
```
配置8080端口和8081端口,访问80端口的时候会自动代理到其中之一