
我剛剛在我的家庭伺服器上部署了一個 Seafile 伺服器。 Seafile 的部署成功,沒有出現任何錯誤。所以我嘗試設定nginx。
我的 nginx 設定:
server {
root /var/www/mydomain;
index index.html;
server_name mydomain.de
return 301 mydomain.de$request_uri;
}
server {
root /var/www/mydomain;
index index.html;
server_name http://www.mydomain.de;
}
server {
listen 80;
server_name www.cloud.mydomain.de;
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;
proxy_send_timeout 36000s;
}
location /media {
root /home/myuser/seafile/seafile-server-latest/seahub;
}
}
我的 ccnet.conf:
SERVICE_URL = http://www.cloud.mydomain.de
seahub_settings.py(最後一行):
FILE_SERVER_ROOT = 'http://www.cloud.mydomain.de/seafhttp'
前兩個伺服器區塊工作正常且符合預期。但是當我嘗試訪問 www.cloud.mydomain.de 時,我只是得到一個空白頁面(重定向到 www.cloud.mydomain.de/defaultsite)
http://www.cloud.mydomain.de/ => redirect to /defaultsite (cause of domain hoster?) and blank page
http://www.cloud.mydomain.de/seafhttp => blank page
http://www.cloud.mydomain.de/media => blank page
我雖然確保 Seafile 伺服器正在運行:
./seafile.sh start
./seahub.sh start-fastcgi
有什麼建議可以解決我的問題嗎?
答案1
server_name http://www.mydomain.de;
是不正確的。
指令中僅新增域名server_name
,不包括協定。
另外,第一個server
區塊的行上沒有分號server_name
,因此它也不應該起作用。
實際上,前兩個server
區塊沒有任何意義。第一個區塊配置301
不包含重定向協定的重定向。return
指令必須包含協定。
您確定 DNSwww.cloud.mydomain.de
已正確配置嗎?