Seafile的配置

如果部署在apache或nginx后面,就是访问默认80或443。反向代理会帮你转到8000和8082上。

我使用443,我在路由器上设定了转发,比如 对外网12323这个端口会转到内网地址443上

我使用seafile就会是 https://外网ip:12323 9 , 客户端也是配置使用这个地址。

然后在SERVICE_URL 是 https://外网ip:12323 9 FILE_SERVER_ROOT 是 https://外网ip:12323/seafhttp 1

如果你只在内网中使用,使用apache或ngix,就是访问https://内网ip
SERVICE_URL 是 https://内网ip:12323 FILE_SERVER_ROOT 是 https://内网ip:12323/seafhttp 1

如果你没使用apache和ngix,在外面访问, 那么要在路由器上对8000和8082都做映射。 比如4XXXX,5XXXX
SERVICE_URL 和 FILE_SERVER_ROOT 要写外网ip和映射的端口。

如果你8000 和 8082不做映射,对外也是用8000和8082 ,那么就是最普通配置,但是写外网ip。

 

https://bbs.seafile.com/t/seafile/731/2

 

https://atjason.com/412.html

 

https://manual-cn-origin.seafile.com/deploy/qi-ta-bu-shu-shuo-ming/deploy_seafile_behind_nat

 

 

 

脚本安装的信息文档在

/opt/seafile/aio_seafile-server

数据库用户名和密码存储在

/opt/seafile.my.cnf

根用户存储在

/root/.my.cnf

 

https://blog.51cto.com/7309656/2420009

Seahub 是 Seafile 服务器的网站界面. SeafServer 用来处理浏览器端文件的上传与下载. 默认情况下, 它在 8082 端口上监听 HTTP 请求
而平时我们访问IP地址或域名的时候都不喜欢带端口号进入访问,故使用nginx来做反向代理
1.在安装好的seafile服务器上安装nginx或者单独配置一台新的机器来安装nginx,为了方便,nginx和seafile就安装在同一台机器上。
命令:
yum -y install nginx
Nginx组合seafile
2.为seafile单独创建一个配置文件(此配置文件只是http访问的,如果需要https的,请参考seafile的官网操作)
命令:
vi /etc/nginx/conf.d/seafile.conf
内容如下:
server {
listen 80;
server_name 192.168.80.120;
proxy_set_header X-Forwarded-For $remote_addr;
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_read_timeout 1200s;
client_max_body_size 0;
access_log /var/log/nginx/seahub.access.log;
error_log /var/log/nginx/seahub.error.log;
}

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;
            proxy_request_buffering off;
}
location /media {
    root /usr/local/seafile/seafile-server-latest/seahub;
}

}
Nginx组合seafile

3.修改文件gunicorn.conf
命令
/usr/local/seafile/conf/gunicorn.conf #修改/usr/local/seafile/conf/gunicorn.conf文件,把里面的bind="0.0.0.0:8001"修改为bind="127.0.0.1:8000"
Nginx组合seafile
4.修改文件seahub_settings.py
命令:vi /usr/local/seafile/conf/seahub_settings.py
在此文件中添加如下一个内容:
FILE_SERVER_ROOT = 'http://192.168.80.120/seafhttp'
Nginx组合seafile
5.重启启动seahub,并开启nginx服务
命令:
#进入seafile目录
cd /usr/local/seafile/seafile-server
#重新启动seahub服务
./seahub.sh restart
#检测下nginx的配置文件是否有语法错误
nginx -t
#开启nginx服务
systemctl start nginx
#设置nginx开机自动启动
systemctl enable nginx
Nginx组合seafile
6.打开网页输入http://192.168.80.120是否能访问
Nginx组合seafile

 

 

/etc/nginx/conf.d/seafile.conf监听本地80端口,然后反向代理至8000-seahub,8082-seafhttp,8080-seafdav

路由器转发端口10000:80即可。

external-url 填入域名:10000

如果想修改某个内部端口

关掉服务

systemctl stop seahub

systemctl stop  seafile

首先修改seafile.conf的监听端口如 8080-》8081

然后修改对应文件 /opt/seafile/conf/seafdav.conf 中的端口8080-》8081

重启 systemctl restart nginx

systemctl start seahub

systemctl start  seafile

posted @ 2020-06-11 23:10  FightingFor  阅读(3835)  评论(0编辑  收藏  举报