Nginx 환경 설정
server {
server_name _;
location /api {
include uwsgi_params;
rewrite ^/api(.*)$ $1?$args break;
proxy_pass http://unix:/run/gunicorn.sock;
}
location /ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://daphne-server;
}
}
upstream daphne-server {
server 127.0.0.1:8443;
}
upstream 으로 daphne 다중 클러스터 로드밸런싱
Daphne service 등록
vi /etc/systemd/system/daphne.service
[Unit]
Description=daphne daemon
[Service]
User=ubuntu
Group=ubuntu
WorkingDirectory=/opt/web/{project_name}
Environment="CUDA=cuda:0"
Environment="PATH=/home/wisysta/anaconda3/envs/{env_name}"
ExecStart=/home/wisysta/anaconda3/envs/{env_name}/bin/daphne \
-b 0.0.0.0 -p 8443 {django_service_name}.asgi:application
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
Restart=on-abort
PrivateTmp=true
[Install]
WantedBy=multi-user.target
'[실무개발] > DevOps, Linux, Analytics' 카테고리의 다른 글
Docker 로컬(mac) 이미지 원격(AWS EC2) 배포 (0) | 2023.09.24 |
---|---|
Ubuntu Docker 설치 (0) | 2023.09.24 |
.gitignore 전에 push 된 리모트 파일 삭제 (0) | 2023.01.17 |
아마존 리눅스2 - 아나콘다 - Gunicorn - nginx - git 을 이용한 장고(django)서버 배포(4) (0) | 2022.07.18 |
아마존 리눅스2 - 아나콘다 - Gunicorn - nginx - git 을 이용한 장고(django)서버 배포(3) (0) | 2022.07.18 |