到底怎样才能启用https

按照官网的中文版手册和英文版手册都试了好多遍,都不能使用https访问,可以通过http访问。都是全新安装的ubuntu server 2204.4
证书是我之前自己申请的,在我另一个网站用的好好的,在seafile就是不能用。谁能帮我,可以有偿

这是docker-compose.yml的配置文件
services:
db:
image: mariadb:10.11
container_name: seafile-mysql
environment:
- MYSQL_ROOT_PASSWORD=db_dev # Required, set the root’s password of MySQL service.
- MYSQL_LOG_CONSOLE=true
- MARIADB_AUTO_UPGRADE=1
volumes:
- /opt/seafile-mysql/db:/var/lib/mysql # Required, specifies the path to MySQL data persistent store.
networks:
- seafile-net

memcached:
image: memcached:1.6.18
container_name: seafile-memcached
entrypoint: memcached -m 256
networks:
- seafile-net

seafile:
image: seafileltd/seafile-mc:11.0-latest
container_name: seafile
ports:
- “80:80”
- “4431:443” # If https is enabled, cancel the comment.
volumes:

  - /home/dd/fullchain.pem:/shared/ssl/1.changshuai.org.crt
  - /home/dd/privkey.pem:/shared/ssl/1.changshuai.org.key
  - /opt/seafile-data:/shared   # Required, specifies the path to Seafile data persistent store.
environment:
  - DB_HOST=db
  - DB_ROOT_PASSWD=db_dev  # Required, the value should be root's password of MySQL service.
  - TIME_ZONE=Etc/UTC  # Optional, default is UTC. Should be uncomment and set to your local time zone.
  - SEAFILE_ADMIN_EMAIL=me@example.com # Specifies Seafile admin user, default is 'me@example.com'.
  - SEAFILE_ADMIN_PASSWORD=asecret     # Specifies Seafile admin password, default is 'asecret'.
  - SEAFILE_SERVER_LETSENCRYPT=false   # Whether to use https or not.
  - SEAFILE_SERVER_HOSTNAME=1.changshuai.org # Specifies your host name if https is enabled.
  - FORCE_HTTPS_IN_CONF=true
depends_on:
  - db
  - memcached
networks:
  - seafile-net

networks:
seafile-net:

中文版手册和英文版手册配置的方法还不一样,都照做了好几遍都不行,想着docker不应就按照原始方法安装,照做也报错

Please choose a way to initialize seafile databases:

[1] Create new ccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases

[ 1 or 2 ] 1

What is the host of mysql server?
[ default “localhost” ]

What is the port of mysql server?
[ default “3306” ]

What is the password of the mysql root user?
[ root password ]

verifying password of user root …
verifying password of user root …
Failed to connect to mysql server using user “root” and password “***”: Can’t connect to MySQL server on ‘localhost’ ([Errno 2] No such file or directory)

我也遇到了相同的问题,原因是修改了容器内Nginx的ssl设置,其服务器依旧返回http协议,不提供https服务。你可以直接访问http://域名:443,而不是https://域名,你甚至可以通过另一个nginx反代http://域名:443提供https服务
正确的解决方法:
1、docker compose down
2、删除已自动生成的/opt/seafile-data/nginx/conf/seafile.nginx.conf
3、修改docker-compose.yml中SEAFILE_SERVER_LETSENCRYPT=false为true
4、检查/opt/seafile-data/ssl目录中ssl证书是否存在
如果一定要用映射方式,请自行检查容器内能否正确读取证书,部分容器使用文件映射方式存在BUG
5、docker compose up -d等待一段时间docker compose down,还原docker-compose.yml中SEAFILE_SERVER_LETSENCRYPT=false
6、docker compose up -d 即可正常使用

1 个赞