在Ubuntu系统下为MinIO配置SSL证书,可以按照以下步骤进行:
首先,你需要获取一个SSL证书。你可以从Let’s Encrypt免费获取,或者购买一个商业证书。
安装Certbot:
sudo apt update
sudo apt install certbot
获取证书:
sudo certbot certonly --standalone -d yourdomain.com -d www.yourdomain.com
按照提示完成证书的获取和安装。
MinIO支持通过环境变量或配置文件来配置SSL证书。
你可以在启动MinIO服务器时通过环境变量指定SSL证书和密钥文件的路径。
export MINIO_CERT_FILE=/etc/letsencrypt/live/yourdomain.com/fullchain.pem
export MINIO_KEY_FILE=/etc/letsencrypt/live/yourdomain.com/privkey.pem
minio server /data
你也可以创建一个配置文件来指定SSL证书和密钥文件的路径。
创建配置文件:
sudo nano /etc/minio/config.json
在配置文件中添加以下内容:
{
"certificates": [
{
"certificate": "/etc/letsencrypt/live/yourdomain.com/fullchain.pem",
"key": "/etc/letsencrypt/live/yourdomain.com/privkey.pem"
}
]
}
启动MinIO服务器时指定配置文件:
minio server --config /etc/minio/config.json /data
启动MinIO服务器后,你可以通过浏览器访问你的域名,并检查浏览器地址栏中的锁图标,确认SSL证书是否正确安装。
Let’s Encrypt的证书有效期为90天,因此你需要设置自动续期。
安装Certbot的自动续期工具:
sudo apt install certbot
设置自动续期:
sudo crontab -e
添加以下行:
0 0,12 * * * certbot renew --post-hook "systemctl reload minio"
确保MinIO服务在证书续期后重新加载:
sudo systemctl reload minio
通过以上步骤,你就可以在Ubuntu系统下为MinIO配置SSL证书,并确保证书的自动续期。