diff --git a/.github/workflows/update_primary_nginx.yml b/.github/workflows/update_primary_nginx.yml index 8a11737..8d46840 100644 --- a/.github/workflows/update_primary_nginx.yml +++ b/.github/workflows/update_primary_nginx.yml @@ -14,20 +14,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Export environment variables - run: | - export URL_PREFIX=http:// - export PORT_PREFIX=2 - export DEV_POSTFIX=1 - export STAG_POSTFIX=2 - export PROD_POSTFIX=3 - export DEV_PORT_PREFIX=${PORT_PREFIX}${GROUP_ID}${DEV_POSTFIX} - export STAG_PORT_PREFIX=${PORT_PREFIX}${GROUP_ID}${STAG_POSTFIX} - export PROD_PORT_PREFIX=${PORT_PREFIX}${GROUP_ID}${PROD_POSTFIX} - - name: Replace environment variables in Nginx config run: | - envsubst < ./nginx_template.txt > ./nginx_secfit.conf + envsubst '${DEV_PORT_PREFIX} ${PROD_PORT_PREFIX} ${STAG_PORT_PREFIX} ${GATEWAY_POSTFIX}' < nginx_secfit.conf > nginx/nginx.conf # Test the nginx configuration - name: Test nginx configuration file @@ -37,7 +26,7 @@ jobs: # Copying nginx configuration file to the server - name: Deploy nginx configuration file run: | - sudo cp ./nginx_secfit.conf /etc/nginx/conf.d/nginx.conf + sudo cp ./nginx/nginx.conf /etc/nginx/conf.d/nginx.conf # Restarting nginx service - name: Restart nginx service diff --git a/nginx_template.txt b/nginx_template.txt index 26926ed..6ff2deb 100644 --- a/nginx_template.txt +++ b/nginx_template.txt @@ -12,7 +12,7 @@ server { server { listen ${DEV_PORT_PREFIX}7; location / { - proxy_pass http://0.0.0.0:${envDEV_PORT_PREFIX}${GATEWAY_POSTFIX}/; + proxy_pass http://0.0.0.0:${DEV_PORT_PREFIX}${GATEWAY_POSTFIX}/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;