Seahub 是 Seafile 服务器的网站界面. SeafServer 用来处理浏览器端文件的上传与下载. 默认情况下, 它在 8082 端口上监听 HTTP 请求 而平时我们访问IP地址或域名的时候都不喜欢带端口号进入访问,故使用nginx来做反向代理 1.在安装好的seafile服务器上安装nginx或者单独配置一台新的机器来安装nginx,为了方便,nginx和seafile就安装在同一台机器上。 命令: yum -y install nginx 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;
}

}

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" 4.修改文件seahub_settings.py 命令:vi /usr/local/seafile/conf/seahub_settings.py 在此文件中添加如下一个内容: FILE_SERVER_ROOT = 'http://192.168.80.120/seafhttp' 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 6.打开网页输入http://192.168.80.120是否能访问