ubuntu部署minio和nginx
时间: 2024-10-16 13:01:25 浏览: 46
在Ubuntu上部署MinIO和Nginx,你需要完成以下几个步骤:
1. **更新系统并安装依赖**:
```bash
sudo apt update && sudo apt install -y nginx minio-tools
```
2. **下载并配置MinIO**:
MinIO是一个开源的对象存储服务器,首先从官方仓库获取最新的deb包:
```bash
wget https://dl.min.io/server/minio/release-latest/debian/minio_$(curl -sI https://api.min.io | grep '^X-amd64.deb
sudo dpkg -i minio*.deb
```
配置MinIO,这通常会在安装过程中引导你设置管理员凭据等信息。完成后,启动服务并检查是否运行正常:
```bash
sudo systemctl start minio
sudo systemctl enable minio
minio admin --url http://localhost:9000 ls
```
3. **配置Nginx作为前端代理**:
Nginx将用于提供反向代理,保护MinIO服务器,并提供更友好的URL访问。编辑`/etc/nginx/sites-available/default`文件,添加类似以下内容(替换`your_minio_bucket`和`your_minio_username`、`your_minio_password`为实际值):
```
server {
listen 80;
server_name your_domain.com;
location / {
proxy_pass http://localhost:9000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Amz-Date $time_local;
proxy_set_header Authorization "AWS4-HMAC-SHA256 Credential=${your_minio_username}:${your_minio_password}@minio/${date}/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=";
}
}
```
4. **启用Nginx站点并重启服务**:
```bash
sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
```
5. **测试访问**:
使用浏览器访问`http://your_domain.com`,如果一切顺利,应该能看到MinIO的控制台。
阅读全文