This repository contains an Nginx configuration template that sets up a file serving system with support for both local filesystem and Minio S3 storage backends.
The configuration provides a flexible file server that can serve files from either:
- Local filesystem
- Minio S3 bucket (via an S3 gateway)
The server listens on port 8080 and handles file downloads through the /downloads endpoint.
- Nginx server
- If using S3:
- S3 gateway service
- Proper AWS credentials configuration
The configuration supports two storage providers, controlled by the $gpkgProvider variable:
If using S3, ensure your S3 gateway URL is properly configured in the $ngnixS3Gateway variable.
-
Filesystem Storage (FS)
- Files are served directly from the local filesystem
- Root directory:
/usr/share/nginx/html - All file types are allowed
-
S3 Storage (S3)
- Files are served from an S3 bucket via a gateway
- Includes proxy configuration for efficient large file handling
- Maintains original request information through headers
- Files can be accessed through the
/downloadsendpoint:http://localhost:8080/downloads/path/to/file
Common issues and their solutions:
-
504 Gateway Timeout
- Check if the timeouts need to be increased for your use case
- Verify S3 gateway connectivity
-
503 Service Unavailable
- Check if the buffer sizes need to be adjusted
- Verify system resources
-
404 Not Found
- For FS: Check if files exist in
/usr/share/nginx/html - For S3: Verify file paths and S3 bucket configuration
- For FS: Check if files exist in