Skip to content

Commit

Permalink
Changes again to config
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritzs committed Mar 4, 2025
1 parent 8ed15db commit 1d5a2b5
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 36 deletions.
16 changes: 2 additions & 14 deletions .github/workflows/update_primary_nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,11 @@ jobs:

- name: Replace environment variables in Nginx config
run: |
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
run: |
envsubst '${DEV_PORT_PREFIX} ${PROD_PORT_PREFIX} ${STAG_PORT_PREFIX} ${GATEWAY_POSTFIX}' < nginx_template.txt > nginx_secfit.conf
sudo mv nginx_secfit.conf /etc/nginx/conf.d/nginx.conf
sudo nginx -t
# Copying nginx configuration file to the server
- name: Deploy nginx configuration file
run: |
sudo cp nginx/nginx.conf /etc/nginx/conf.d/nginx.conf
# Restarting nginx service
- name: Restart nginx service
run: |
sudo systemctl restart nginx
- name: Show deployed configuration
run: |
cat /etc/nginx/conf.d/nginx.conf
62 changes: 40 additions & 22 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,31 +1,49 @@
server {
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}

http {
server {
listen 80;

# Route to frontend
location / {
proxy_pass http://0.0.0.0:23/;
proxy_set_header Host ;
proxy_set_header X-Real-IP ;
proxy_set_header X-Forwarded-For ;
proxy_pass http://frontend:3000;
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;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

server {
listen 217;
location / {
proxy_pass http://0.0.0.0:/;
proxy_set_header Host ;
proxy_set_header X-Real-IP ;
proxy_set_header X-Forwarded-For ;
# Route to backend
location /api/ {
proxy_pass http://backend:8000;
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;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

location /admin/ {
proxy_pass http://backend:8000;
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;
proxy_set_header X-Forwarded-Proto $scheme;
}

server {
listen 227;
location / {
proxy_pass http://0.0.0.0:22/;
proxy_set_header Host ;
proxy_set_header X-Real-IP ;
proxy_set_header X-Forwarded-For ;
location /static/admin/ {
proxy_pass http://backend:8000;
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;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
}

0 comments on commit 1d5a2b5

Please sign in to comment.