Linux 시스템 설정 nginx 의 부하 균형
부하 균형 의 몇 가지 방식:
1. 폴 링: 기본적으로 시간 순서에 따라 모든 서버 에 한 번 씩 접근 합 니 다. 서버 가 다운 되면 자동 으로 삭 제 됩 니 다.
2. weight: 서버 의 방위 확률 은 weight 와 정비례 합 니 다. 이것 은 서버 설정 이 고 르 지 않 을 때 설정 할 수 있 습 니 다.
3.ip_hash: 모든 요청 한 ip 에 대해 hash 계산 을 하고 일정한 규칙 에 따라 해당 하 는 서버 를 분배 합 니 다 (session 공 유 를 해결 할 수 있 습 니 다).
4. fair: 각 서버 의 응답 시간 (rt) 에 따라 요청 을 분배 합 니 다. rt 는 우선 분 배 를 알 고 있 습 니 다.
5.url_hash: url 에 접근 한 hash 값 에 따라 요청 을 분배 합 니 다.
NGINX 프로필:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include blockip.conf; # IP
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
upstream www. .com {
server IP1: ; # 1
server IP2: ; # 2
ip_hash; #
}
server {
listen 80 default_server; #NGINX
listen [::]:80 default_server;
server_name IP; #NGINX IP
root /usr/share/nginx/html; #NGINX HTML
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://www. .com; #nginx
}
error_page 404 /404.html;
location = /40x.html { #404
}
error_page 500 502 503 504 /500.html;
location = /500.html { #500
}
}
}
읽 어 주 셔 서 감사합니다. 여러분 에 게 도움 이 되 기 를 바 랍 니 다. 본 사이트 에 대한 여러분 의 지지 에 감 사 드 립 니 다!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.