seafile部署+nginx分离

部署

  • To-Do

URL设置

image.png
  • SERVICE_URL https://seafile.my-domain.com:5443, http://192.168.1.210:8000
  • FILE_SERVER_ROOT https://seafile.my-domain.com:5443/seafhttp

配置nginx

seafile.vhost.conf

server {
    listen       80;
    server_name  seafile.my-domain.com;
    rewrite ^ https://$http_host$request_uri? permanent;    # force redirect http to https
    # Enables or disables emitting nginx version on error pages and in the "Server" response header field.
    server_tokens off;
}

server {
    listen 5443 ssl;
    ssl_certificate /etc/letsencrypt/live/seafile.my-domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/seafile.my-domain.com/privkey.pem;
    server_name seafile.my-domain.com;
    ssl_session_timeout 10m;
    # ssl_session_cache shared:SSL:10m;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-CAMELLIA256-SHA:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-SEED-SHA:DHE-RSA-CAMELLIA128-SHA:HIGH:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS';

    ssl_prefer_server_ciphers on;
    proxy_set_header X-Forwarded-For $remote_addr;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
    server_tokens off;

    location / {
        proxy_pass         http://192.168.1.210: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_set_header   X-Forwarded-Proto https;

        access_log      /var/log/nginx/seahub.access.log;
        error_log       /var/log/nginx/seahub.error.log;

        proxy_read_timeout  1200s;
        client_max_body_size 0;
    }

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://192.168.1.210: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 ~ .*\.(js|css|jpg|png)$ {
        proxy_pass http://192.168.1.210:8000;
    }

    location /media {
        # rewrite ^/media(.*)$ $1 break;   # seafile 与 nginx部署在一台机器上时需要取消注释
        # root /root/seafile/seafile-server-latest/seahub;    # seafile与nginx部署在一台机器上时使用该配置
        proxy_pass http://192.168.1.210:8000/media/;    # seafile与nginx分离时使用该配置
    }
}

你可能感兴趣的:(seafile部署+nginx分离)