码迷,mamicode.com
首页 > Web开发 > 详细

seafile启用https访问

时间:2019-07-21 01:33:44      阅读:627      评论:0      收藏:0      [点我收藏+]

标签:路径   psk   tls   tin   cdh   include   time   md5   定向   

seafile启用https会比http访问更安全,故启用https访问
1.创建目录并上传证书
命令:
mkdir /etc/cacert
技术图片

2.编辑nginx的seafile.conf配置文件,以便能启用https访问
命令:
vi /etc/nginx/conf.d/seafile.conf 如此文件有内容,请清空,重新加入如下内容

server {
listen 80;
server_name 域名/IP; #此处的域名/IP请修改为相对应的
rewrite ^ https://$http_host$request_uri? permanent; #强制将http重定向到https
server_tokens off;
}
server {
listen 444;
ssl on;
ssl_certificate /etc/cacert/cacert.pem; #cacert.pem 文件路径
ssl_certificate_key /etc/cacert/privkey.key; #privkey.pem 文件路径
server_name 域名/IP; #此处的域名/IP请修改为相对应的
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ‘ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-CAMELLIA256-SHA:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-SEED-SHA:DHE-RSA-CAMELLIA128-SHA:HIGH:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS‘;
ssl_prefer_server_ciphers on;
proxy_set_header X-Forwarded-For $remote_addr;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
server_tokens off;

location / {
    proxy_pass         http://127.0.0.1:8000;
    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-Host $server_name;
    proxy_set_header   X-Forwarded-Proto https;
    access_log      /var/log/nginx/seahub.access.log;
    error_log       /var/log/nginx/seahub.error.log;
    proxy_read_timeout  1200s;
    client_max_body_size 0;
}

location /seafhttp {
    rewrite ^/seafhttp(.*)$ $1 break;
    proxy_pass http://127.0.0.1:8082;
    client_max_body_size 0;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_connect_timeout  36000s;
    proxy_read_timeout  36000s;
    proxy_send_timeout  36000s;
    send_timeout  36000s;
}
location /media {
    root /usr/local/seafile/seafile-server-latest/seahub;
}

}
技术图片
技术图片
技术图片
技术图片

3.编辑seafile目录的conf配置文件目录中的seahub_settings.py
命令:
vi /usr/local/seafile/conf/seahub_settings.py
把FILE_SERVER_ROOT = ‘http://cloud.jvtc.com.cn:888/seafhttp
修改为
FILE_SERVER_ROOT = ‘https://cloud.jvtc.com.cn:444/seafhttp
技术图片

4.重启nginx,seafile,seahub服务
命令:
cd /usr/local/seafile/seafile-server
./seafile.sh restart
./seahub.sh restart
nginx -t
systemctl restart nginx
技术图片

5.浏览器中使用https://域名或IP:444访问是否正常
技术图片

seafile启用https访问

标签:路径   psk   tls   tin   cdh   include   time   md5   定向   

原文地址:https://blog.51cto.com/7309656/2421914

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!