Nginx组合seafile

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值