nginx负载均衡

2023-12-13 04:58:23

yum安装的nginx 的话

[root@localhost ~]# cd /etc/nginx/conf.d/

[root@localhost conf.d]# ll

总用量 8

-rw-r–r-- 1 root root 1072 4月 12 2023 default.conf.bak

-rw-r–r-- 1 root root 454 12月 9 10:54 upstream.conf

[root@localhost conf.d]#vim upstream.conf

upstream testweb {

server 192.168.128.166:80;
server 192.168.128.199:8080;

}
server {
listen 80;
server_name localhost;
charset utf-8;
#access_log logs/host.access.log main;
location / {
proxy_pass http://testweb;
proxy_set_header Host h o s t : host: host:server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

另外两台代理服务器我安装的是tomcat和php

文章来源:https://blog.csdn.net/xubaodong_1/article/details/134909264
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。