Skip to content

nityam2007/lite-s3

Repository files navigation

πŸš€ Lite-S3

S3-Compatible Object Storage for Shared Hosting

License: GPL v3 PHP Version PRs Welcome

Finally, run your own S3 storage on any $5/month shared hosting!

Quick Start β€’ Features β€’ Screenshots β€’ API Docs β€’ License


πŸ€” What is this?

Ever wanted Amazon S3-like storage but don't want to pay AWS prices? Or maybe you're stuck on shared hosting (cPanel) and can't run MinIO or other S3 alternatives?

Lite-S3 is a pure PHP implementation of S3-compatible object storage. It works on any hosting that supports PHP and MySQL β€” yes, even that cheap shared hosting you're already paying for!

✨ Features

Feature Description
πŸ”Œ S3 Compatible Works with AWS SDK, rclone, boto3, s3cmd
πŸ‘₯ Multi-User Each user gets their own credentials
πŸ” Permissions Read / Write / Admin per bucket
πŸ“ Big Files Upload files up to 5GB with multipart
πŸ“Ή Range Requests Video seeking and partial downloads
πŸ›‘οΈ Rate Limiting Configurable request limits per IP
πŸ” Security Scan Blocks malicious file uploads
🎨 Admin Panel Beautiful web UI to manage everything
πŸ’Ύ Easy Backups Plain files + MySQL = simple backups
🏠 Shared Hosting Works on cPanel, DirectAdmin, Plesk
🏷️ Tagging Object & bucket tagging support
πŸ”„ Lifecycle Bucket lifecycle rules & policies
🌐 CORS Full CORS configuration per bucket
πŸ“¦ Batch Ops DeleteObjects batch delete API

πŸ“Έ Screenshots

Dashboard

Dashboard

User Management

Users

Bucket Management

Buckets

πŸš€ Quick Start

🐳 Docker (Fastest - Just 2 commands!)

git clone https://github.com/nityam2007/lite-s3.git
cd lite-s3
docker-compose up -d

That's it! Everything auto-configures:

  • βœ… MySQL database created and initialized
  • βœ… Admin user created (admin/admin123)
  • βœ… Health check ready

URLs:

Test it:

# List buckets
curl -u admin:admin123 http://localhost:8080/

# Create bucket
curl -X PUT -u admin:admin123 http://localhost:8080/my-bucket

# Upload file
curl -X PUT -u admin:admin123 -d "Hello World" http://localhost:8080/my-bucket/hello.txt

# Download file
curl -u admin:admin123 http://localhost:8080/my-bucket/hello.txt

πŸ–₯️ LAMP/XAMPP/WAMP (Auto Setup)

git clone https://github.com/nityam2007/lite-s3.git
cd lite-s3
./setup.sh

The setup script will:

  1. Check PHP and extensions
  2. Ask for database credentials
  3. Create database and import schema
  4. Generate config.php
  5. Set permissions

Then point your web server to the WWW/ folder.


🏠 Shared Hosting (cPanel/DirectAdmin/Plesk)

  1. Download this repo and upload WWW/ contents to your public_html
  2. Create MySQL Database in cPanel β†’ MySQL Databases
  3. Run Installer at https://yourdomain.com/install.php
  4. Delete install.php after setup
  5. Login with admin / admin123 and change password!

βš™οΈ Manual Setup (Any Environment)

  1. Copy config.sample.php to config.php
  2. Edit config.php with your database credentials
  3. Import schema.sql into your MySQL database
  4. Ensure these directories are writable: storage/, logs/, uploads/
  5. Visit /admin/ to login

πŸ”§ API Usage

Authentication

Lite-S3 supports multiple authentication methods:

Method Format Best For
Basic Auth -u access_key:secret_key Testing, simple scripts
AWS Signature V4 AWS4-HMAC-SHA256 Production, AWS SDKs
AWS Signature V2 AWS access_key:signature Legacy tools
Presigned URLs ?X-Amz-Signature=... Shareable links

Upload a File

# Using Basic Auth (simplest)
curl -X PUT -u your_access_key:your_secret_key \
  -T ./myfile.txt \
  https://yourdomain.com/my-bucket/myfile.txt

# Using AWS signature
curl -X PUT \
  -H "Authorization: AWS your_access_key:your_secret_key" \
  -T ./myfile.txt \
  https://yourdomain.com/my-bucket/myfile.txt

Download a File

curl -H "Authorization: AWS your_access_key:your_secret_key" \
  https://yourdomain.com/my-bucket/myfile.txt -o myfile.txt

With Python (boto3)

import boto3

s3 = boto3.client('s3',
    endpoint_url='https://yourdomain.com',
    aws_access_key_id='your_access_key',
    aws_secret_access_key='your_secret_key'
)

# Upload
s3.upload_file('local.txt', 'my-bucket', 'remote.txt')

# Download  
s3.download_file('my-bucket', 'remote.txt', 'local.txt')

With rclone

[mycloud]
type = s3
provider = Other
endpoint = https://yourdomain.com
access_key_id = your_access_key
secret_access_key = your_secret_key

⚠️ Known Limitations

Lite-S3 implements core S3 features but is not 100% compatible with the full AWS S3 spec.

Feature Status Notes
List Buckets βœ… Complete
Create/Delete Bucket βœ… Complete
Put/Get/Delete Object βœ… Complete
List Objects (v1 & v2) βœ… Complete
Head Object βœ… Complete
CopyObject βœ… Complete Server-side copy
Range Requests βœ… Complete Byte-range downloads
Presigned URLs βœ… Complete
AWS Signature V4 βœ… Complete
AWS Signature V2 βœ… Complete
Basic Auth βœ… Complete
Multipart Uploads βœ… Complete Full support
Rate Limiting βœ… Complete Configurable limits
Security Scanning βœ… Complete Blocks dangerous files
DeleteObjects (Batch) βœ… Complete Delete multiple objects in one request
Object Tagging βœ… Complete GET/PUT/DELETE object tags
Bucket Tagging βœ… Complete GET/PUT/DELETE bucket tags
Bucket CORS βœ… Complete Full CORS configuration
Bucket Lifecycle βœ… Complete Expiration & transition rules
Bucket Versioning βœ… Complete Enable/disable versioning
Bucket Policies βœ… Complete JSON IAM-style policies
Object Metadata βœ… Complete x-amz-meta-* headers
Object ACLs ❌ Missing Bucket-level only

πŸ“‹ Requirements

  • PHP 8.0+
  • MySQL 5.7+ or MariaDB 10+
  • mod_rewrite enabled (Apache) or equivalent (nginx)
  • .htaccess support or nginx config

PHP Extensions (auto-detected):

  • pdo, pdo_mysql - Database
  • json - API responses
  • hash - Authentication
  • mbstring - String handling

Most shared hosting plans already have all of this! πŸŽ‰

πŸ”’ Security Notes

  1. Delete install.php after setup
  2. Change default password immediately (admin β†’ something secure)
  3. Use HTTPS in production (required for AWS SDK signature verification)
  4. Regular backups of both database and storage/ folder
  5. Set proper permissions - storage/, logs/, uploads/ should be writable by web server
  6. Keep config.php secure - never commit to public repos

πŸ“Š Monitoring

Health check endpoint for load balancers and monitoring:

curl http://localhost:8080/health.php

Returns JSON with status of database, storage, and extensions.

πŸ’¬ Support & Links

πŸ“œ License

This project is licensed under GNU GPLv3 with attribution requirements.

You can:

  • βœ… Use commercially
  • βœ… Modify and distribute
  • βœ… Use for any purpose

You must:

  • πŸ“Œ Keep attribution/credits visible
  • πŸ“Œ Release modifications under GPLv3
  • πŸ“Œ Link back to original project

See LICENSE for details.


Made with ❀️ by Nityam Sheth

If this helped you, give it a ⭐!

About

S3-compatible object storage for shared hosting (cPanel). Pure PHP, multi-user, 5GB file support.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published