diff --git a/infra/nginx/templates/ssl-server.template b/infra/nginx/templates/ssl-server.template index 8bd2f677..3fdca313 100644 --- a/infra/nginx/templates/ssl-server.template +++ b/infra/nginx/templates/ssl-server.template @@ -1,7 +1,13 @@ server { listen 443 ssl; server_name ${SERVER_DOMAIN}; + access_log /home/ubuntu/moabam/logs/access_ssl_moabam.log main; + error_log /home/ubuntu/moabam/logs/error.log error; + location ^~ /actuator { + return 404; + } + ssl_certificate /etc/letsencrypt/live/${SERVER_DOMAIN}/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/${SERVER_DOMAIN}/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; diff --git a/infra/scripts/deploy-dev.sh b/infra/scripts/deploy-dev.sh index d11b09c0..cc6debda 100644 --- a/infra/scripts/deploy-dev.sh +++ b/infra/scripts/deploy-dev.sh @@ -1,8 +1,8 @@ #!/bin/bash # .env 파일 로드 -if [ -f /home/ubuntu/moabam/.env ]; then - source /home/ubuntu/moabam/.env +if [ -f /home/ubuntu/moabam/infra/.env ]; then + source /home/ubuntu/moabam/infra/.env fi if [ $(docker ps | grep -c "nginx") -eq 0 ]; then @@ -46,8 +46,8 @@ echo "### springboot blue-green 무중단 배포 시작 ###" echo IS_BLUE=$(docker ps | grep ${BLUE_CONTAINER}) -NGINX_CONF="/home/ubuntu/moabam/nginx/nginx.conf" -UPSTREAM_CONF="/home/ubuntu/moabam/nginx/conf.d/upstream.conf" +NGINX_CONF="/home/ubuntu/moabam/infra/nginx/nginx.conf" +UPSTREAM_CONF="/home/ubuntu/moabam/infra/nginx/conf.d/upstream.conf" if [ -n "$IS_BLUE" ]; then echo "### BLUE => GREEN ###" diff --git a/infra/scripts/init-letsencrypt.sh b/infra/scripts/init-letsencrypt.sh index b9040e36..1031fd25 100644 --- a/infra/scripts/init-letsencrypt.sh +++ b/infra/scripts/init-letsencrypt.sh @@ -1,8 +1,8 @@ #!/bin/bash # .env 파일 로드 -if [ -f /home/ubuntu/moabam/.env ]; then - source /home/ubuntu/moabam/.env +if [ -f /home/ubuntu/moabam/infra/.env ]; then + source /home/ubuntu/moabam/infra/.env fi if ! [ -x "$(command -v docker-compose)" ]; then @@ -12,7 +12,7 @@ fi domains="${SERVER_DOMAIN}" rsa_key_size=4096 -data_path="/home/ubuntu/moabam/nginx/certbot" +data_path="/home/ubuntu/moabam/infra/nginx/certbot" email="${MY_EMAIL}" # Adding a valid address is strongly recommended staging=1 # Set to 1 if you're testing your setup to avoid hitting request limits diff --git a/infra/scripts/init-nginx-converter.sh b/infra/scripts/init-nginx-converter.sh index 934f88c5..861b2aeb 100644 --- a/infra/scripts/init-nginx-converter.sh +++ b/infra/scripts/init-nginx-converter.sh @@ -1,14 +1,14 @@ #!/bin/bash # .env 파일 로드 -if [ -f /home/ubuntu/moabam/.env ]; then - source /home/ubuntu/moabam/.env +if [ -f /home/ubuntu/moabam/infra/.env ]; then + source /home/ubuntu/moabam/infra/.env fi export SERVER_DOMAIN=${SERVER_DOMAIN} export SERVER_PORT=${SERVER_PORT} export BLUE_CONTAINER=${BLUE_CONTAINER} -envsubst '$SERVER_DOMAIN' < /home/ubuntu/moabam/nginx/templates/http-server.template > /home/ubuntu/moabam/nginx/conf.d/http-server.conf -envsubst '$SERVER_DOMAIN' < /home/ubuntu/moabam/nginx/templates/ssl-server.template > /home/ubuntu/moabam/nginx/conf.d/ssl-server.conf -envsubst '$BLUE_CONTAINER $SERVER_PORT' < /home/ubuntu/moabam/nginx/templates/upstream.template > /home/ubuntu/moabam/nginx/conf.d/upstream.conf +envsubst '$SERVER_DOMAIN' < /home/ubuntu/moabam/infra/nginx/templates/http-server.template > /home/ubuntu/moabam/infra/nginx/conf.d/http-server.conf +envsubst '$SERVER_DOMAIN' < /home/ubuntu/moabam/infra/nginx/templates/ssl-server.template > /home/ubuntu/moabam/infra/nginx/conf.d/ssl-server.conf +envsubst '$BLUE_CONTAINER $SERVER_PORT' < /home/ubuntu/moabam/infra/nginx/templates/upstream.template > /home/ubuntu/moabam/infra/nginx/conf.d/upstream.conf