# Nginx 下配置 Seahub
### 準備工作
Ubuntu 下安裝`python-flup`庫:
~~~
sudo apt-get install python-flup
~~~
### Nginx 環境下部署 Seahub/SeafServer
Seahub 是 Seafile 服務器的網站界面. SeafServer 用來處理瀏覽器端文件的上傳與下載. 默認情況下, 它在 8082 端口上監聽 HTTP 請求.
這里我們通過 fastcgi 部署 Seahub, 通過反向代理(Reverse Proxy)部署 SeafServer. 我們假設你已經將 Seahub 綁定了域名"www.myseafile.com".
這是一個 Nginx 配置文件的例子 (你可以創建文件 /etc/nginx/conf.d/seafile.conf, 并拷貝以下內容, 如果你用 gedit 編輯,別忘了刪除 seafile.conf~ 這個臨時文件).
~~~server {
listen 80;
server_name www.myseafile.com;
proxy_set_header X-Forwarded-For $remote_addr;
location / {
fastcgi_pass 127.0.0.1:8000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REMOTE_ADDR $remote_addr;
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_connect_timeout 36000s;
proxy_read_timeout 36000s;
}
location /media {
root /home/user/haiwen/seafile-server-latest/seahub;
}
}
~~~
Nginx 默認設置 "client_max_body_size" 為 1M。如果上傳文件大于這個值的話,會報錯,相關 HTTP 狀態碼為 423 ("Request Entity Too Large"). 你可以將值設為 `0` 以禁用此功能.
### 修改 ccnet.conf 和 seahub_setting.py
### 修改 ccnet.conf
你需要在`/data/haiwen/ccnet/ccnet.conf`的`SERVICE_URL`字段中自定義域名。
~~~SERVICE_URL = http://www.myseafile.com
~~~
注意:如果你改變了 Seahub的域名,也需要同步更改`SERVICE_URL`.
### 修改 seahub_settings.py
請在`seahub_settings.py`新增一行,設定`FILE_SERVER_ROOT`的值
~~~
FILE_SERVER_ROOT = 'http://www.myseafile.com/seafhttp'
~~~
### 啟動 Seafile 和 Seahub
~~~./seafile.sh start
./seahub.sh start-fastcgi
~~~
- 介紹
- 概覽
- Seafile 組件
- 研發路線圖
- 常見問題解答
- 修改日志
- 我要參與
- Linux 下部署 Seafile 服務器
- 部署 Seafile 服務器(使用 SQLite)
- 部署 Seafile 服務器(使用 MySQL)
- Nginx 下配置 Seahub
- Nginx 下啟用 Https
- Apache 下配置 Seahub
- Apache 下啟用 Https
- Seafile LDAP 配置
- 開機啟動 Seafile
- 防火墻設置
- Logrotate 管理系統日志
- 使用 Memcached
- 使用 NAT
- 非根域名下部署 Seahub
- 從 SQLite 遷移至 MySQL
- 安裝常見問題
- 升級
- Windows 下部署 Seafile 服務器
- 下載安裝 Windows 版 Seafile 服務器
- 安裝 Seafile 為 Windows 服務
- 所用端口說明
- 升級
- 從 Windows 遷移到 Linux
- 垃圾回收
- 部署 Seafile 專業版服務器
- 下載安裝 Seafile 專業版服務器
- 從社區版遷移至專業版
- 升級
- Amazon S3 下安裝
- OpenStackSwift 下安裝
- Ceph 下安裝
- 配置選項
- 文件搜索說明
- 集群部署
- 集群中啟用搜索和后臺服務
- NFS 下集群安裝
- 常見問題解答
- 軟件許可協議
- 服務器個性化配置
- ccnet.conf
- seafile.conf
- seahub_settings.py
- 發送郵件提醒
- 個性化郵件提醒
- 用戶管理
- 存儲容量與文件上傳/下載大小限制
- 自定義 Web
- 管理員手冊
- 賬戶管理
- 日志
- 備份與恢復
- Seafile FSCK
- Seafile GC
- WebDAV 和 FUSE 擴展
- WebDAV 擴展
- FUSE 擴展
- 安全選項
- 安全特性
- 日志和審計
- 開發文檔
- 編譯 Seafile
- Linux
- Windows
- Max OS X
- Server
- 開發環境
- 編程規范
- Web API
- Python API
- 數據模型
- 服務器組件
- 同步算法