From 1a87a4db142b4cd75015119618a2963142203019 Mon Sep 17 00:00:00 2001 From: omaroughriss Date: Wed, 2 Jul 2025 15:37:34 +0200 Subject: [PATCH] Add nginx config --- nginx.dev.conf | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 nginx.dev.conf diff --git a/nginx.dev.conf b/nginx.dev.conf new file mode 100644 index 0000000..d5dcba5 --- /dev/null +++ b/nginx.dev.conf @@ -0,0 +1,48 @@ +server { + listen 80; + server_name localhost; + + # Redirection des requĂȘtes HTTP vers Vite + location / { + proxy_pass http://localhost:3001; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + } + + location /ws/ { + proxy_pass http://localhost:8090; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + 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_set_header X-NginX-Proxy true; + proxy_read_timeout 86400; + } + + location /storage/ { + rewrite ^/storage(/.*)$ $1 break; + proxy_pass http://localhost:8080; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + } + + location /api/ { + proxy_pass http://localhost:8091; + 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; + + # CORS headers + add_header Access-Control-Allow-Origin "*" always; + add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE" always; + add_header Access-Control-Allow-Headers "Authorization,Content-Type,Accept,X-Requested-With" always; + } +} \ No newline at end of file