|
| 1 | +# Define an upstream server group named 'backend' for the application backend |
| 2 | +upstream backend { |
| 3 | + server backend:8000; # Application backend address and port |
| 4 | +} |
| 5 | + |
| 6 | +# Define an upstream server group named 'minio' for the MinIO server |
| 7 | +upstream minio { |
| 8 | + server minio:9000; # MinIO server address and port |
| 9 | +} |
| 10 | + |
| 11 | +server { |
| 12 | + listen 80; # Listen on port 80 for incoming HTTP requests |
| 13 | + server_name bookly; # Add this line to match the hostname used in the SSH tunnel |
| 14 | + client_max_body_size 20M; # Set maximum allowed client request body size to 20MB |
| 15 | + |
| 16 | + error_log /var/log/nginx/error.log error; # Main error log file |
| 17 | + |
| 18 | + # Set proxy headers to pass client request information to the backend servers |
| 19 | + proxy_set_header Host $http_host; # Changed from $host to $http_host |
| 20 | + proxy_set_header X-Real-IP $remote_addr; |
| 21 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 22 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 23 | + |
| 24 | + proxy_http_version 1.1; # Use HTTP/1.1 for proxy connections |
| 25 | + proxy_buffering off; # Disable proxy buffering |
| 26 | + |
| 27 | + # WebSocket support |
| 28 | + proxy_set_header Upgrade $http_upgrade; |
| 29 | + proxy_set_header Connection "upgrade"; |
| 30 | + |
| 31 | + # Location block for the API |
| 32 | + location /api/v1/ { |
| 33 | + proxy_pass http://backend/api/v1/; # Proxy requests to the application backend |
| 34 | + access_log /var/log/nginx/backend_access.log; # Access log file for the API |
| 35 | + error_log /var/log/nginx/backend_error.log error; # Error log file for the API |
| 36 | + } |
| 37 | + |
| 38 | + # Location block for the swagger schema |
| 39 | + location /swagger/schema/ { |
| 40 | + proxy_pass http://backend/api/v1/openapi.json; # Proxy requests to the application backend |
| 41 | + access_log /var/log/nginx/swagger_access.log; # Access log file for the swagger schema |
| 42 | + } |
| 43 | + |
| 44 | + # Location block for the swagger documentation |
| 45 | + location /swagger/redoc/ { |
| 46 | + proxy_pass http://backend/api/v1/redoc/; # Proxy requests to the application backend |
| 47 | + access_log /var/log/nginx/swagger_access.log; # Access log file for the swagger documentation |
| 48 | + } |
| 49 | + |
| 50 | + # Location block for the swagger documentation |
| 51 | + location /swagger/docs/ { |
| 52 | + proxy_pass http://backend/api/v1/docs/; # Proxy requests to the application backend |
| 53 | + access_log /var/log/nginx/swagger_access.log; # Access log file for the swagger documentation |
| 54 | + } |
| 55 | + |
| 56 | + # Location block for MinIO storage |
| 57 | + location /minio/storage/bookly/ { |
| 58 | + proxy_pass http://minio/bookly/; # Proxy requests to the MinIO server |
| 59 | + access_log /var/log/nginx/minio_access.log; # Access log file for MinIO |
| 60 | + error_log /var/log/nginx/minio_error.log error; # Error log file for MinIO |
| 61 | + } |
| 62 | +} |
0 commit comments