Skip to content

Instantly share code, notes, and snippets.

@frengky
Created July 22, 2022 10:11
Show Gist options
  • Save frengky/047f824247f2253696d1beadd506aee3 to your computer and use it in GitHub Desktop.
Save frengky/047f824247f2253696d1beadd506aee3 to your computer and use it in GitHub Desktop.
S3 Compatible Object Storage Server (MinIO)

S3 Compatible Object Storage Server (MinIO)

1. Download minio and mc binary for linux

Put the binary in /opt/minio/bin:

wget https://dl.min.io/server/minio/release/linux-amd64/minio
wget https://dl.min.io/client/mc/release/linux-amd64/mc

2. Install as linux service

Credentials file: /opt/minio/credentials.env

MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=minioadmin

Service file: /lib/systemd/system/minio.service

[Unit]
Description=S3 compatible object storage server

[Service]
Type=simple
EnvironmentFile=/opt/minio/credentials.env
ExecStart=/opt/minio/bin/minio server --address ":9000" --console-address ":9001" /mnt/data

[Install]
WantedBy=multi-user.target

Create the data directory:

mkdir /mnt/data

Start it:

systemctl start minnio

3. Prepare the reverse proxy

Use nginx as the reverse proxy for our object storage, to allow access object url but not listing the bucket directory.

server {
  listen        80;
  server_name  static.domain.com;

  location ~ ^/(your|list|of|public|bucket)/(.+)$ {
    proxy_pass http://ip.address.of.minio:9000;
  }

  location / {
    return 403;
  }
}

Now you can access your files via http://static.domain.com/yourbucket/filename.jpg and the console via http://ip.address.of.minio:9001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment