我正试图让Seafile在nginx反向代理后面运行。我跟着这个:http://manual.seafile.com/deploy/deploy_with_nginx.html以及http://manual.seafile.com/deploy/https_with_nginx.html。
我的配置如下:
我的seahub_settings.py看起来像这样:
HTTP_SERVER_ROOT = 'https://cloud.mydomain.tld/seafhttp' -- I added this to try it
FILE_SERVER_ROOT = 'https://cloud.mydomain.tld/seafhttp'
SECRET_KEY = "12345678-1234-1234-1234-1234567890123456"
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'seahub-db',
'USER': 'seafile',
'PASSWORD': 'mypassword',
'HOST': '127.0.0.1',
'PORT': '3306',
'OPTIONS': {
'init_command': 'SET storage_engine=INNODB',
}
}
}
我的nginx配置:
### Cloud ###
# No-SSL redirect
server {
listen 80;
server_name cloud.mydomain.tld;
return 301 https://$server_name$request_uri;
}
# SSL
server {
listen 443 ssl;
server_name cloud.mydomain.tld;
ssl_certificate /etc/letsencrypt/live/cloud.mydomain.tld/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/cloud.mydomain.tld/privkey.pem;
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;
fastcgi_read_timeout 36000;
}
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;
send_timeout 36000s;
}
location /media {
root /home/cloud/seafile-server-latest/seahub;
}
}
所以现在,当我删除旧的seahub_settings.pyc时,启动seahub(当然是在fastcgi模式下),将浏览器指向我的库并尝试上传内容,我在F12开发者控制台中收到以下错误消息:
main.ad03aea1e16e.js:215 Mixed Content: The page at 'https://cloud.mydomain.tld/#my-libs/lib/12345678-1234-1234-1234-123456789012' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://cloud.mydomain.tld:8082/upload-aj/12345678-1234-1234-1234-123456789012'. This request has been blocked; the content must be served over HTTPS.
send @ main.ad03aea1e16e.js:215
这意味着,seahub仍在尝试连接到“旧”上传服务,这当然不再有用了。到目前为止,我没有找到解决这个问题的方法。
答案 0 :(得分:2)
我刚刚遇到同样的问题就找到了你的问题。
这很简单:在seahub-db(使用MySQL,同样适用于sqlite)中有一个constance_config记录配置并覆盖普通的配置文件。
可以从管理控制台(右上角)修改此配置,也可以直接截断此表以重新生成。
这是一项新功能'从5.0.0开始(http://manual.seafile.com/config/index.html)。
此致 于连