sudo vi /etc/nginx/conf.d/load-balancer.conf
upstream backend {
server 127.0.0.1:8001;
server 127.0.0.1:8082;
server 10.1.0.103:8081;
server 10.1.0.103:8082;
}
sudo vi /etc/nginx/nginx.conf
... 생략
server {
listen 80;
location / {
proxy_pass http://backend;
... 생략
Load balancing methods
upstream backend {
least_conn;
server 10.1.0.101;
server 10.1.0.102;
server 10.1.0.103;
}
upstream backend {
ip_hash;
server 10.1.0.101;
server 10.1.0.102;
server 10.1.0.103;
}
upstream backend {
server 10.1.0.101 weight=4;
server 10.1.0.102 weight=2;
server 10.1.0.103;
}
Load balancing with HTTPS enabled
server {
listen 443 ssl;
server_name domain_name;
ssl_certificate /etc/letsencrypt/live/domain_name/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/domain_name/privkey.pem;
location / {
proxy_pass http://backend;
}
}
참고 :
https://upcloud.com/community/tutorials/configure-load-balancing-nginx/
'IT > Linux_Apache_Nginx' 카테고리의 다른 글
Start / Stop and Restart Apache 2 Web Server Command (0) | 2019.11.05 |
---|---|
[Linux]특정시간 파일을 지우는프로그램을 crond 에 등록 하기 (0) | 2019.11.04 |
Linux Shell 예제 (0) | 2019.09.19 |
zsh 쉘에서 단어 단위 이동 설정 (0) | 2019.09.18 |
Apache Rewrite Module (0) | 2019.08.07 |