13

I am running minio in a docker container and I want files that are uploaded to be accessible by the public. I have tried with nginx however that is just a reverse proxy. The problem is that minio has a access key and a secret so if I setup nginx as a reverse proxy I still need to login.

I want to make it possible to download files through nginx or apache. Is there a way to make files/buckets within minio publicly accessible without having to login so that I can create direct links to the file?

Martijn Hiemstra
  • 927
  • 2
  • 14
  • 30
  • Can you explain what exactly a kind of file? Build results? From what kind of builds? – khmarbaise Dec 20 '20 at 18:29
  • Thank you for your response. I have decided to build something for myself since minio doesnt seem to have any decent public access.. – Martijn Hiemstra Dec 23 '20 at 07:59
  • I would suggest to use a Nexus repository manager instance... minio has appropriate permission settings which makes it possible... – khmarbaise Dec 23 '20 at 08:02

2 Answers2

10

To set the default policy for unauthenticated users, the command is mc policy set download minio_alias/bucketname

Source: https://docs.min.io/docs/minio-client-complete-guide.html

For an example of using nginx for hosting the files, here's a github gist: How to configure static website using Nginx with MinIO?

Dash
  • 1,191
  • 7
  • 19
  • 1
    The problem is that the official minio docker container doesnt have the mc command. It says mc is an unknown command. – Martijn Hiemstra Feb 08 '21 at 08:32
  • You can either install the mc client on a local machine, or use the [mc client container](https://hub.docker.com/r/minio/mc/) – Dash Feb 08 '21 at 17:39
  • If using docker you can read more information on this page: https://stackoverflow.com/questions/66412289/minio-add-a-public-bucket-with-docker-compose – Martijn Hiemstra Nov 04 '22 at 16:45
7
# list default hosts after install: 
mc config host ls

# remove all hosts: mc config host rm {hostName}
mc config host rm local

# add your host: mc config host add {hostName} {url} {apiKey} {apiSecret}
mc config host add local http://127.0.0.1:9000 ClientIdASSDSD ClientSecretASASASdsasdasdasdasd

# create bucket: mc mb {host}/{bucket}
mc mb local/mybucket

# change bucket policy: mc policy {policy} {host}/{bucket}
mc policy set public local/mybucket
tapos ghosh
  • 2,114
  • 23
  • 37
  • 1
    For recent versions of minio: `mc anonymous set public myminio/public` https://min.io/docs/minio/linux/reference/minio-mc/mc-anonymous-set.html – DavidG Nov 24 '22 at 13:09