From 6423a45b64a8181be98e2830541d41e720866085 Mon Sep 17 00:00:00 2001 From: Ogu1208 Date: Thu, 5 Sep 2024 18:40:10 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20home/ubuntu/=EB=A1=9C=20=EB=B3=B5?= =?UTF-8?q?=EC=82=AC=20=ED=9B=84=20SSH=EB=A5=BC=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=ED=95=B4=20sudo=EB=A1=9C=20=ED=8C=8C=EC=9D=BC=EC=9D=84=20/etc/?= =?UTF-8?q?nginx/conf.d/=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 권한 문제: /etc/nginx/conf.d/는 시스템 디렉토리로, 일반 사용자(예: ubuntu)는 해당 디렉토리에 쓸 권한이 없습니다. 따라서 scp-action에서 sudo 없이 해당 디렉토리에 파일을 복사할 수 없습니다. 2. 경로 접근 문제: scp-action으로 복사한 후, sudo 권한을 사용해 적절한 위치로 파일을 이동해야 합니다. --- .github/workflows/dev-aws-CI-CD.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dev-aws-CI-CD.yml b/.github/workflows/dev-aws-CI-CD.yml index acabdc8..fa284b3 100644 --- a/.github/workflows/dev-aws-CI-CD.yml +++ b/.github/workflows/dev-aws-CI-CD.yml @@ -75,23 +75,26 @@ jobs: - name: Show docker-compose.yml Content run: cat docker-compose.yml # docker-compose.yml 파일 내용 확인 - - name: Send docker-compose.yml + # Send nginx.conf to a temporary location + - name: Send nginx.conf to Home Directory uses: appleboy/scp-action@master with: username: ubuntu host: ${{ secrets.AWS_DEV_HOSTNAME }} key: ${{ secrets.AWS_DEV_PRIVATE_KEY }} - source: "./docker-compose.yml" + source: "./nginx/conf.d/nginx.conf" target: "/home/ubuntu/" - - name: Send nginx.conf - uses: appleboy/scp-action@master + # Move nginx.conf from Home Directory to /etc/nginx/conf.d + - name: Move nginx.conf to /etc/nginx/conf.d + uses: appleboy/ssh-action@master with: username: ubuntu host: ${{ secrets.AWS_DEV_HOSTNAME }} key: ${{ secrets.AWS_DEV_PRIVATE_KEY }} - source: "./nginx/conf.d/nginx.conf" - target: "/etc/nginx/conf.d/" + script: | + sudo mkdir -p /etc/nginx/conf.d/ + sudo mv /home/ubuntu/nginx.conf /etc/nginx/conf.d/nginx.conf ## Docker login - name: Docker Login