diff --git a/docker-compose.yml b/docker-compose.yml index ed26574..647a7be 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -837,6 +837,7 @@ services: - MINIO_BUCKET=ragflow volumes: - ragflow_data:/ragflow + - ./ragflow/nginx.conf:/etc/nginx/sites-available/default:ro depends_on: infinity: condition: service_started diff --git a/ragflow/nginx.conf b/ragflow/nginx.conf new file mode 100644 index 0000000..f4d2d72 --- /dev/null +++ b/ragflow/nginx.conf @@ -0,0 +1,69 @@ +server { + listen 80; + server_name _; + + # Increase max body size for file uploads + client_max_body_size 100M; + + # Serve static files from the web frontend + location / { + root /ragflow/web/dist; + try_files $uri $uri/ /index.html; + index index.html; + } + + # Proxy API requests to Flask backend + location /v1/ { + proxy_pass http://127.0.0.1:9380; + 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_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 300s; + proxy_connect_timeout 75s; + } + + # Proxy admin API requests to admin Flask backend + location /v1/admin/ { + proxy_pass http://127.0.0.1:9381; + 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_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 300s; + proxy_connect_timeout 75s; + } + + # Additional API endpoints + location ~ ^/(api|auth|files)/ { + proxy_pass http://127.0.0.1:9380; + 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_http_version 1.1; + proxy_read_timeout 300s; + proxy_connect_timeout 75s; + } + + # Static assets with caching + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + root /ragflow/web/dist; + expires 1y; + add_header Cache-Control "public, immutable"; + } + + # Health check endpoint + location /health { + access_log off; + return 200 "healthy\n"; + add_header Content-Type text/plain; + } +} +