Skip to content

Commit

Permalink
Merge branch 'main' of https://git.ntnu.no/mauritzs/secfit
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritzs committed Mar 4, 2025
2 parents 7261bfb + 74f00bb commit e07a0b0
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 67 deletions.
31 changes: 31 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
server {
listen 80;

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 ;
}
}

server {
listen 217;
location / {
proxy_pass http://0.0.0.0:21/;
proxy_set_header Host ;
proxy_set_header X-Real-IP ;
proxy_set_header X-Forwarded-For ;
}
}


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 ;
}
}
62 changes: 22 additions & 40 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,49 +1,31 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}

http {
server {
server {
listen 80;

# Route to frontend
location / {
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;
proxy_pass http://0.0.0.0:23/;
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;
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 ;
}
}

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;
}

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;
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 ;
}
}
}
}
50 changes: 23 additions & 27 deletions nginx_secfit.conf
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
# Production server configuration
server {
listen 80;
listen 80;

location / {
proxy_pass http://0.0.0.0:${PROD_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;
}
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 ;
}
}

# Development server configuration
server {
listen ${DEV_PORT_PREFIX}7;

location / {
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;
}
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 ;
}
}

# Staging server configuration
server {
listen ${STAG_PORT_PREFIX}${GATEWAY_POSTFIX}7;

location / {
proxy_pass http://0.0.0.0:${STAG_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;
}
}
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 ;
}
}

0 comments on commit e07a0b0

Please sign in to comment.