小弟依照官網 https://doc.owncloud.org/server/10.2/admin_manual/installation/docker/
使用Docker安裝好了OwnCloud了
但是想要掛載憑證轉換成HTTPS的時候,卡了一天
一開始是想到使用 nginx反向代理
upstream drive.scott.com {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name drive.scott.com;
rewrite ^(.*) https://$host$1 permanent;
location / {
proxy_pass http://drive.scott.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
server_name drive.scott.com;
#啟用 SSL 服務
listen 443 ssl http2;
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4";
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
#設定 SSL 憑證
ssl_certificate /etc/letsencrypt/live/scott.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/scott.com/privkey.pem;
add_header Strict-Transport-Security max-age=63072000;
location / {
proxy_pass http://drive.scott.com;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
目前查看 nginx/access.log 確實有經過 nginx,但回報 502 Bad Gateway 的錯誤
利用telnet測試,不管是內外網都能走 127.0.0.1 8080 通
初步判斷,似乎是沒有吃到服務的問題
後來改用 https://owncloud.org/news/docker-owncloud-traefik-reverse-proxy-lets-encrypt-ssl/
也是官方提供文件,反而卡在最後添加OwnCloud容器那邊
報錯訊息ERROR: yaml.scanner.ScannerError: mapping values are not allowed here in "/opt/ownCloud/docker-compose.yml", line 18, column 16