Tweaking nginx and env vars

This commit is contained in:
2025-04-12 23:47:47 -04:00
parent 99f23cb05b
commit 67334d5dd0
6 changed files with 11 additions and 16 deletions

9
.env
View File

@@ -5,9 +5,8 @@ NGINX_SSL_ENABLED=false
NGINX_PROTOCOL=http NGINX_PROTOCOL=http
NGINX_HTTP_PORT=8080 NGINX_HTTP_PORT=8080
NGINX_HTTPS_PORT=8443 NGINX_HTTPS_PORT=8443
NGINX_MINIO_HOST=host.docker.internal # Set to 'localhost' or 'host.docker.internal' or '172.17.0.1'
NGINX_API_HOST=host.docker.internal NGINX_INTERNAL_HOST=host.docker.internal
NGINX_UI_HOST=host.docker.internal
POSTGRES_HOST=localhost POSTGRES_HOST=localhost
POSTGRES_USER=aviation POSTGRES_USER=aviation
@@ -27,11 +26,7 @@ MINIO_PORT=9000
MINIO_PORT_INTERNAL=9001 MINIO_PORT_INTERNAL=9001
MINIO_BROWSER_REDIRECT_URL=${NGINX_PROTOCOL}://${NGINX_HOST}:${NGINX_HTTPS_PORT}/minio/ MINIO_BROWSER_REDIRECT_URL=${NGINX_PROTOCOL}://${NGINX_HOST}:${NGINX_HTTPS_PORT}/minio/
UI_PROTOCOL=http
UI_PORT=3000 UI_PORT=3000
API_PROTOCOL=http
API_HOST=0.0.0.0
API_PORT=5000 API_PORT=5000
SSL_CA_NAME=ca SSL_CA_NAME=ca

View File

@@ -70,7 +70,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.expect("Failed to create reqwest client"); .expect("Failed to create reqwest client");
let state = AppState { client }; let state = AppState { client };
let host = env::var("API_HOST").unwrap_or("localhost".to_string()); let host = "0.0.0.0";
let port = env::var("API_PORT").unwrap_or("5000".to_string()); let port = env::var("API_PORT").unwrap_or("5000".to_string());
let server = match HttpServer::new(move || { let server = match HttpServer::new(move || {

View File

@@ -1,3 +1,4 @@
vars { vars {
BASE_URL: https://localhost:8443 ~BASE_URL: https://localhost:8443
BASE_URL: http://localhost:8080
} }

View File

@@ -94,7 +94,6 @@ services:
dockerfile: Dockerfile dockerfile: Dockerfile
env_file: *env env_file: *env
environment: environment:
API_HOST: 0.0.0.0
SSL_CA_PATH: /ssl/ca.pem SSL_CA_PATH: /ssl/ca.pem
POSTGRES_HOST: aviation-postgres POSTGRES_HOST: aviation-postgres
POSTGRES_PORT: 5432 POSTGRES_PORT: 5432

View File

@@ -5,7 +5,7 @@ server {
server_name ${NGINX_HOST}; server_name ${NGINX_HOST};
location /api/ { location /api/ {
proxy_pass ${API_PROTOCOL}://${NGINX_API_HOST}:${API_PORT}/api/; proxy_pass http://${NGINX_INTERNAL_HOST}:${API_PORT}/api/;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -13,7 +13,7 @@ server {
} }
location /minio/ { location /minio/ {
proxy_pass ${MINIO_PROTOCOL}://${NGINX_MINIO_HOST}:${MINIO_PORT_INTERNAL}/; proxy_pass http://${NGINX_INTERNAL_HOST}:${MINIO_PORT_INTERNAL}/;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -22,7 +22,7 @@ server {
# Reverse proxy for the UI and default catch-all # Reverse proxy for the UI and default catch-all
location / { location / {
proxy_pass ${UI_PROTOCOL}://${NGINX_UI_HOST}:${UI_PORT}/; proxy_pass http://${NGINX_INTERNAL_HOST}:${UI_PORT}/;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View File

@@ -25,7 +25,7 @@ server {
# ssl_prefer_server_ciphers on; # ssl_prefer_server_ciphers on;
location /api/ { location /api/ {
proxy_pass ${API_PROTOCOL}://${NGINX_API_HOST}:${API_PORT}/api/; proxy_pass http://${NGINX_INTERNAL_HOST}:${API_PORT}/api/;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -33,7 +33,7 @@ server {
} }
location /minio/ { location /minio/ {
proxy_pass ${MINIO_PROTOCOL}://${NGINX_MINIO_HOST}:${MINIO_PORT_INTERNAL}/; proxy_pass http://${NGINX_INTERNAL_HOST}:${MINIO_PORT_INTERNAL}/;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -42,7 +42,7 @@ server {
# Reverse proxy for the UI and default catch-all # Reverse proxy for the UI and default catch-all
location / { location / {
proxy_pass ${UI_PROTOCOL}://${NGINX_UI_HOST}:${UI_PORT}/; proxy_pass http://${NGINX_INTERNAL_HOST}:${UI_PORT}/;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;