mirror of
https://gh.wpcy.net/https://github.com/hochenggang/simple-php-s3-server.git
synced 2026-07-14 11:06:38 +08:00
1.8 KiB
1.8 KiB
PHP S3 Compatible Gateway
A lightweight S3-compatible object storage server implemented in PHP, using local filesystem as storage backend.
Features
- S3 Object API compatibility (PUT/GET/DELETE/HEAD)
- Multipart upload support (create/UploadPart/complete/abort)
- AWS Signature V4 authentication
- Pure filesystem storage (no database required)
- Configuration via
.envfile
Quick Start
- Upload to your web server
Upload all files to your website root directory.
- Configure
Edit .env file:
ALLOWED_ACCESS_KEYS=your-access-key1,your-access-key2
DEFAULT_SECRET_KEY=your-secret-key
- Start using
Connect using any S3-compatible client:
import boto3
s3 = boto3.client(
's3',
endpoint_url='https://your-domain.com',
aws_access_key_id='your-access-key1',
aws_secret_access_key='your-secret-key',
region_name='us-east-1', # Can be any value
verify=False
)
# Upload file
s3.upload_file('local.txt', 'bucket', 'remote.txt')
# Download file
s3.download_file('bucket', 'remote.txt', 'local.txt')
Configuration
| Variable | Description | Default |
|---|---|---|
DATA_DIR |
Data storage directory | ./data |
ALLOWED_ACCESS_KEYS |
Access keys (comma-separated) | - |
DEFAULT_SECRET_KEY |
Secret key | - |
MAX_REQUEST_SIZE |
Max request size (bytes) | 104857600 |
AUTH_DEBUG |
Enable debug logging | false |
Supported Operations
- Bucket: List, Create, Delete
- Object: Put, Get, Head, Delete, Copy, List
- Multipart: Create, UploadPart, Complete, Abort, ListParts
Storage
Objects are stored at: ./data/{bucket}/{key}
License
MIT