我有一个简单的两节点服务器,运行在localhost:3000和localhost:3001上,使用NGINX进行负载平衡。 但遇到错误。
“此处不允许使用ip_hash指令”
当我删除conf中的ip_hash时,发生另一个错误
有人知道解决方案吗?
下面是我的nginx.conf,/ etc / nginx / nginx.conf的http上下文
stream {
upstream stream_mongo_backend {
server 127.0.0.1:27017;
# a pool with at most 1024 connections
# and do not distinguish the servers:
# keepalive 1024 single;
}
server {
listen 27020;
proxy_connect_timeout 1s;
proxy_timeout 10s;
proxy_pass stream_mongo_backend;
}
upstream redisbackend {
server 127.0.0.1:6379;
# a pool with at most 1024 connections
# and do not distinguish the servers:
}
server {
listen 6380;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass redisbackend;
}