0
点赞
收藏
分享

微信扫一扫

Nignx负载均衡

栖桐 2022-09-06 阅读 195


2分钟搭建企业轻量级负载均衡服务器

文章目录

  • ​​一、启动2个tomcat端口为8080和8081​​
  • ​​二、在/usr/local/nginx/conf/vhost创建static.imooc.com.conf文件​​

一、启动2个tomcat端口为8080和8081

二、在/usr/local/nginx/conf/vhost创建static.imooc.com.conf文件

内容如下:

upstream loadforward{
server 192.168.1.102:8080;
server 192.168.1.102:8081;
}
server {
listen 80;
server_name static.imooc.com;
location / {
proxy_pass http://loadforward;
}
}

编辑hosts文件配置,域名映射

Nignx负载均衡_ooc


重启nginx

/usr/local/nginx

./sbin/nginx -s reload

Nignx负载均衡_Nignx_02


Nignx负载均衡_nginx_03


举报

相关推荐

0 条评论