Last active
September 5, 2021 08:27
-
-
Save lleellee0/8e1be478178078e931dd3180f0f56d21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Docker 컨테이너를 실행시킬 준비가 되기 위해선 아래 명령어를 입력 | |
sudo yum install docker | |
sudo systemctl start docker | |
sudo chmod 666 /var/run/docker.sock | |
# Nginx 인스턴스에서 다음 명령어로 세팅 | |
sudo yum install nginx | |
sudo systemctl start nginx | |
# 로드밸런싱 설정 | |
sudo vi /etc/nginx/nginx.conf | |
# 위 명령어를 입력하여 nginx 설정 파일로 진입 후 다음과 같이 내용을 변경 | |
upstream cpu-bound-app { | |
server {instance_1번의_ip}:8080 weight=100 max_fails=3 fail_timeout=3s; | |
server {instance_2번의_ip}:8080 weight=100 max_fails=3 fail_timeout=3s; | |
server {instance_3번의_ip}:8080 weight=100 max_fails=3 fail_timeout=3s; | |
} | |
location / { | |
proxy_pass http://cpu-bound-app; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} | |
# 위 설정이 완료되었으면 Nginx를 reload 시켜야함. | |
sudo systemctl reload nginx | |
# Nginx의 에러로그를 확인하기 위한 명령어 | |
sudo tail -f /var/log/nginx/error.log | |
# 에러를 해결할 수 있는 명령어 | |
sudo setsebool -P httpd_can_network_connect on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment