Nginx Proxy for s3 compatible storage & buckets

people

Lets Try

. 1 min read

Nginx can be used as a reverse proxy for S3 compatible storage and buckets. This is useful in many scenarios, including adding authentication, security or custom routing to S3-compatible solutions. The following steps will show you how to configure Nginx for S3 compatible storage.

Installing Nginx

Install Nginx if you haven't done so already. Your operating system will determine the specific method of installation. On a Debian system, for example, you can:

sudo apt-get update
sudo apt-get install nginx

Configure Nginx:

Create a new Nginx configuration file or modify an existing one in the /etc/nginx/sites-available/ directory. For example, you can create a file named yourdomain.com:

sudo nano /etc/nginx/sites-available/yourdomain.com

Here's a basic configuration example:

server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://s3-compatible-storage-endpoint;
    }
}

Replace yourdomain.com with your actual domain or server IP address, and http://s3-compatible-storage-endpoint with the actual URL of your S3-compatible storage provider (e.g., Digitalocean spaces, MinIO, Wasabi, or your self-hosted S3-compatible service). example of Digitalocean space url : https://bucket.sgp1.cdn.digitaloceanspaces.com/ .

Activate the Configuration:

Create a symbolic link to enable the site configuration:

sudo ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/

Test and Reload Nginx:

Before you reload Nginx, it's a good practice to test the configuration for syntax errors:

sudo nginx -t
sudo systemctl reload nginx

If there are no errors, you can reload Nginx to apply the new configuration:

Configure the DNS using Cloudflare

Verify that the DNS records are pointing to the Nginx server, using the name of the domain specified in the Nginx Configuration. With Cloudflare Proxy on you will get https connection.

Access your S3 compatible storage

Now you can access S3 compatible storage via your Nginx proxy. For example, if you set up your proxy for yourdomain.com, you can access your S3-compatible storage at http://yourdomain.com.

This is only a very basic configuration. You may have to make additional settings to optimize and secure your setup, depending on what you need. These include SSL/TLS and authentication. Also, follow the best practices to secure your Nginx Server and S3 compatible storage.

Try S3 buckets free for 60 days

  1. DigitalOcean.com - Get $100 Credit Free for 60 days
  2. vultr.com - Get $100 Credit Free




More Stories from

Lets Try
Lets Try.8 min read

Deploy Boxcoin SAAS on VPS Ubuntu Nginx Server

Looking for the fastest way to run Boxcoin Crypto SAAS on Ubuntu server? We cover the full installation process on Self-Managed VPS of webdock, hetzner, aws

.
Lets Try
Lets Try.4 min read

Set Up Daily MySQL Backups to DigitalOcean Spaces (S3-Compatible)

Step-by-Step Guide to implement Automated MySQL Database Backup to DigitalOcean Spaces or s3 compatible buckets (With Retention & Logs) on Ubuntu server.

.
Lets Try
Lets Try.3 min read

Raspberry Pi NAS: Install OpenMediaVault + CasaOS (Step-by-Step Guide)

Turn your Raspberry Pi into a powerful NAS by installing OMV for RAID storage and CasaOS for a simple UI—build a secure, user-friendly home cloud.

Dev
Dev.2 min read

Window Server 2025 Contabo VPS Install Guide

Window server in contabo is very costly but you can deploy your license key with custom image.

Dev
Dev.1 min read

Setting up SSH keys to a Ubuntu Server with Mac

Generating SSH keys on a Mac for use with an Ubuntu server is a straightforward process. Here’s a step-by-step guide: Generate the SSH Key Pair

.
Built on Koows