网问答>>怎样用 Docker 部署 Seafile 服务器来托管你自己的文件同步和共享解决方案 | Linux 中国
问题
已解决

怎样用 Docker 部署 Seafile 服务器来托管你自己的文件同步和共享解决方案 | Linux 中国

时间:2026-01-06 04:42:59
怎样用 Docker 部署 Seafile 服务器来托管你自己的文件同步和共享解决方案 | Linux 中国
最佳回答
使用Docker部署Seafile服务器可按以下步骤进行,涵盖NGINX配置、Docker安装、Seafile服务部署及客户端连接:一、安装并配置NGINX作为反向代理安装NGINX在Ubuntu系统上运行以下命令安装NGINX:sudo apt install nginx配置HTTPS(可选)如需启用HTTPS,安装Certbot工具:sudo apt install certbot python3-certbot-nginx创建NGINX配置文件编辑Seafile专属配置文件:sudo nano /etc/nginx/sites-available/seafile.conf粘贴以下内容并修改server_name为实际域名或IP:server { server_name seafile.example.com; # 替换为实际域名或IP location / { proxy_pass http://localhost:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; }}启用配置并重启NGINXsudo ln -s /etc/nginx/sites-available/seafile.conf /etc/nginx/sites-enabled/sudo systemctl restart nginx配置HTTPS(可选)运行Certbot自动申请证书:sudo certbot按提示选择域名并配置HTTP到HTTPS的重定向。二、安装Docker与Docker Compose安装Dockersudo apt install docker.io docker-compose验证安装运行测试容器确认安装成功:sudo docker run --rm hello-world添加用户到Docker组(可选)避免每次使用sudo:sudo groupadd dockersudo usermod -aG docker $USER重新登录终端使更改生效。三、部署Seafile服务器创建项目目录mkdir ~/seafile-server && cd ~/seafile-server编写Docker Compose文件创建docker-compose.yml并粘贴以下内容:version: 2.0services: db: image: mariadb container_name: seafile-mysql environment: - MYSQL_ROOT_PASSWORD=strong_password # 替换为强密码 - MYSQL_LOG_CONSOLE=true volumes: - ./data/mariadb:/var/lib/mysql networks: - seafile-net memcached: image: memcached container_name: seafile-memcached entrypoint: memcached -m 256 networks: - seafile-net seafile: image: seafileltd/seafile-mc container_name: seafile ports: - "8080:80" volumes: - ./data/app:/shared environment: - DB_HOST=db - DB_ROOT_PASSWD=strong_password # 与MYSQL_ROOT_PASSWORD一致 - TIME_ZONE=Etc/UTC - SEAFILE_ADMIN_EMAIL=admin@example.com # 设置管理员邮箱 - SEAFILE_ADMIN_PASSWORD=admin_password # 设置管理员密码 - SEAFILE_SERVER_LETSENCRYPT=false - SEAFILE_SERVER_HOSTNAME=seafile.example.com # 与NGINX配置一致 depends_on: - db - memcached networks: - seafile-netnetworks: seafile-net:启动服务docker-compose up -d首次运行需
时间:2026-01-06 04:43:02
本类最有帮助
Copyright © 2008-2013 www.wangwenda.com All rights reserved.冀ICP备12000710号-1
投诉邮箱: