nginx load balancer 하시는분 있나요?

· 2020-10-26 (월) 17:26:32 · 2513 · 5

웹서버 2대 

 

lb 서버 1대해서 테스트 하고 있는데요..

 

80번 포트 웹페이지는 정상적으로 잘 작동하는데요

 

문제가 SSL 이네요

 

letsencrypt

 

사용해서 stadalone으로 받아서 ssl 설치 할려고 했더니...

 

443으로 접속해서 80번으로 넘어가는 과정에서 프로토콜 오류나 나네요

 

보통 LB 서버에만 SSL 설치 하면 되는건가요? 아니면 웹서버 2대에 SSL 설치 해야 하는건가요?

 

 

|

댓글 5개

Traefik을 한번 써보고 싶었는데.. 못써봤네요.. www.apachezone.com 에 서버고수가 있는데
그분은 아파치 전문이라서..
기본적으로 앞단 로드밸런싱 nginx 에서만 적용해도 됩니다.

upstream, proxy_pass 관련 설정 어떻게 하셨나요?
nginx 의 에러로그도 있다면 알려주시구요
2020-11-02 (월) 14:58:11
@mnncloud 이렇게 했지요;;

upstream backend {
server web1 max_fails=3 fail_timeout=15s;
server web2 max_fails=3 fail_timeout=15s;
}

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://backend;
}

이렇게 하니깐..https로 접속 하려 했더니 502가 뜨네요

ssl 설정은.....

listen 443 ssl http2;
server_name aaaaaa.com
client_max_body_size 100M;
server_tokens off;

ssl_certificate "/etc/letsencrypt/live/aaaaa.com/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/aaaaa.com/privkey.pem";

# ssl_dhparam "/etc/ssl/certs/dhparams.pem";
# Set caches, protocols, and accepted ciphers. This config will merit an A+ SSL Labs score.

ssl_session_cache shared:SSL:20m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ecdh_curve secp384r1;
# ssl_prefer_s erver_ciphers on;
ssl_ciphers 'ECDH+AESGCM:ECDH+AES256:ECDH+AES128:!ADH:!AECDH:!MD5';

# Enable HSTS. This forces SSL on clients that respect it, most modern browsers. The includeSubDomains flag is optional
add_header Strict-Transport-Security "max-age=31536000";

ssl_trusted_certificate "/etc/letsencrypt/live/aaaaa.com/chain.pem";
보통 앞단에만 적용하고, 백엔드는 http로 소통합니다.
LB가 nginx 이면.. 백엔드는 php-fpm을 바로 연결하시면 됩니다. 인증서는 lb만 들어가겠죠. (upstream backend를 php-fpm listen 서버 아이피 포트로 설정)


성능을 최적화하고 안정적 운용을 위해 백엔드 서버별로 php-fpm 을 두개나 세개 정도 설정해줍니다. (메모리 cpu코어에 맞춰 늘려줍니다.)
댓글을 작성하시려면 로그인이 필요합니다.

서버관리자

658건

서버관리자 모임 게시판 입니다.

+
제목 글쓴이 날짜 조회
21-03-15 조회 1,960
21-03-13 조회 2,898
21-03-08 조회 1,687
21-03-07 조회 1,686
21-03-07 조회 2,041
21-02-13 조회 2,195
21-01-10 조회 4,961
20-12-17 조회 2,194
20-12-13 조회 1,952
20-12-13 조회 2,209
20-12-01 조회 1,914
20-11-29 조회 2,028
20-11-28 조회 2,233
20-11-27 조회 1,874
20-11-25 조회 2,650
20-11-23 조회 1,928
20-11-17 조회 2,305
20-10-26 조회 2,514
20-10-15 조회 2,863
20-08-20 조회 2,213
20-08-04 조회 1,857
20-08-04 조회 1,932
20-07-29 조회 1,686
20-07-28 조회 1,675
20-07-27 조회 1,532
20-07-25 조회 1,866
20-07-23 조회 1,478
20-07-22 조회 2,000
20-07-21 조회 1,605
20-07-20 조회 1,624