I think I did wrong configuration with /seafilehttp/
, as problems happen with the folder.
For example, downloading tutorial file via such link below always returns 404.
https://seafile.example.com/seafilehttp/files/1a02456f-3723-4c53-bcf1-2ab2e25899dc/seafile-tutorial.doc
I found errors in seahub.log,
2020-06-16 23:36:06,061 [WARNING] django.request:152 get_response Not Found: /seafilehttp/files/be69c2a1-42ac-466f-b38a-0012dfec3f01/seafile-tutorial.doc
my nginx conf is below.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name seafile.example.com;
# Useful for Let's Encrypt
location /.well-known/acme-challenge/ { allow all;}
location / { return 301 https://$host$request_uri; }
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name seafile.example.com;
ssl_protocols TLSv1.2;
ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_dhparam /etc/nginx/dhparam.pem;
ssl_certificate /var/www/cert-cdfs.pem;
ssl_certificate_key /var/www/privkey-cdfs.pem;
keepalive_timeout 70;
sendfile on;
client_max_body_size 40M;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript audio/ogg;
gzip_static always;
location / {
try_files $uri @proxy;
}
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 12000s;
proxy_read_timeout 12000s;
proxy_send_timeout 12000s;
send_timeout 12000s;
}
location /media {
root /opt/seafile/seafile-server-latest/seahub;
}
location @proxy {
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-Proto https;
proxy_set_header Proxy "";
proxy_pass_header Server;
proxy_pass http://127.0.0.1:8000;
proxy_buffering off;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 1200s;
tcp_nodelay on;
# used for view/edit office file via Office Online Server
client_max_body_size 0;
}
# send headers in one peace, its better then sending them one by one
tcp_nopush on;
# don't buffer data sent, good for small data bursts in real time
tcp_nodelay on;
}
my seahub_settings.py is below:
# -*- coding: utf-8 -*-
SECRET_KEY = "b'#6vje$4zxgiy4wuyyf3o8qb&_221rowq43t1&d3)=0@6f+wree'"
FILE_SERVER_ROOT = 'https://file.surlinter.net/seafhttp'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'seahub-db',
'USER': 'seafile',
'PASSWORD': '7',
'HOST': '127.0.0.1',
'PORT': '3306'
}
}
ENABLE_SIGNUP = True
ACTIVATE_AFTER_REGISTRATION = True
ENABLE_OAUTH = True
OAUTH_ENABLE_INSECURE_TRANSPORT = True
OAUTH_CLIENT_ID = "cca7fd0b-19d9-48c7-8d93-b016fa4be1a4"
OAUTH_CLIENT_SECRET = "Vf55a9T1LKop7_2D-.xlhOP_EueqC6sawt"
OAUTH_REDIRECT_URL = "https://file.surlinter.net/oauth/callback/"
OAUTH_PROVIDER_DOMAIN = "login.microsoftonline.com"
OAUTH_AUTHORIZATION_URL = "https://login.microsoftonline.com/f8c80ed6-522e-44be-92f9-e1bd3ebe86bf/oauth2/v2.0/authorize"
OAUTH_TOKEN_URL = "https://login.microsoftonline.com/f8c80ed6-522e-44be-92f9-e1bd3ebe86bf/oauth2/v2.0/token"
OAUTH_USER_INFO_URL = "https://graph.microsoft.com/oidc/userinfo"
OAUTH_SCOPE = ["User.Read", "profile", "email", "openid",]
OAUTH_ATTRIBUTE_MAP = {
"id": (False, "email"),
"name": (False, "name"),
"email": (True, "email"),
}