From db0a46a0b550d94b5d6c316404529e5b6077557a Mon Sep 17 00:00:00 2001 From: Arnaud Nelissen Date: Fri, 10 Apr 2026 00:25:43 +0200 Subject: [PATCH] remove nginx --- CLAUDE.md | 6 +++--- NOTES.md | 2 ++ backend/src/main.rs | 2 +- docker-compose.yml | 4 ++-- frontend/nginx-frontend.conf | 13 +++++++++++-- frontend/vite.config.ts | 2 +- nginx-conf.conf | 12 +++++++++--- 7 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 NOTES.md diff --git a/CLAUDE.md b/CLAUDE.md index 99f38ac..c48e4f4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -777,13 +777,13 @@ services: - DATABASE_URL=sqlite:///data/astronome.db - RUST_LOG=info ports: - - "3301:3301" + - "3001:3001" frontend: build: ./frontend restart: unless-stopped ports: - - "3300:80" + - "3000:80" depends_on: - backend @@ -801,7 +801,7 @@ services: ```nginx # nginx-conf.conf — reverse proxy, single origin for browser -upstream backend { server backend:3301; } +upstream backend { server backend:3001; } upstream frontend { server frontend:80; } server { diff --git a/NOTES.md b/NOTES.md new file mode 100644 index 0000000..6411ade --- /dev/null +++ b/NOTES.md @@ -0,0 +1,2 @@ +# gitea token +4fe62748b43ca89f8bb0472b810aac49fa1fac8d \ No newline at end of file diff --git a/backend/src/main.rs b/backend/src/main.rs index 77771a9..3b7e781 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -37,7 +37,7 @@ async fn main() -> anyhow::Result<()> { let app = api::build_router(pool).layer(cors); - let bind_addr = "0.0.0.0:3301"; + let bind_addr = "0.0.0.0:3001"; tracing::info!("Starting server on {}", bind_addr); let listener = tokio::net::TcpListener::bind(bind_addr).await?; diff --git a/docker-compose.yml b/docker-compose.yml index 4829f45..6deeb9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,13 +8,13 @@ services: - DATABASE_URL=sqlite:///data/astronome.db - RUST_LOG=info ports: - - "3301:3301" + - "3001:3001" frontend: build: ./frontend restart: unless-stopped ports: - - "3300:80" + - "3000:80" depends_on: - backend diff --git a/frontend/nginx-frontend.conf b/frontend/nginx-frontend.conf index 1202162..04d2e6d 100644 --- a/frontend/nginx-frontend.conf +++ b/frontend/nginx-frontend.conf @@ -1,15 +1,24 @@ server { listen 80; + root /usr/share/nginx/html; index index.html; + default_type application/octet-stream; + location / { try_files $uri $uri/ /index.html; } - # Cache static assets + location = /index.html { + expires -1; + add_header Cache-Control "no-cache"; + } + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ { expires 1y; add_header Cache-Control "public, immutable"; } -} + + add_header X-Content-Type-Options nosniff; +} \ No newline at end of file diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index bd97144..7a1efb1 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -6,7 +6,7 @@ export default defineConfig({ server: { proxy: { '/api': { - target: 'http://localhost:3301', + target: 'http://localhost:3001', changeOrigin: true, }, }, diff --git a/nginx-conf.conf b/nginx-conf.conf index 00a86a3..2d5ae9c 100644 --- a/nginx-conf.conf +++ b/nginx-conf.conf @@ -3,17 +3,23 @@ events { } http { - upstream backend { server backend:3301; } + upstream backend { server backend:3001; } upstream frontend { server frontend:80; } server { listen 80; + server_name _; + client_max_body_size 60M; location /api/ { - proxy_pass http://backend; + proxy_pass http://backend/; proxy_set_header Host $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_connect_timeout 10s; proxy_read_timeout 60s; } @@ -22,4 +28,4 @@ http { proxy_set_header Host $host; } } -} +} \ No newline at end of file