seafile网盘使用nginx代理

我是用路由器做端口映射到seafile网盘服务器上,我想使用https方式来进行访问,就必须要借助代理。

nginx 安装方法参考我另一篇文章:https://www.51xiongmao.cn/?p=283

#user  nobody;
worker_processes  4;

error_log  logs/error.log;
error_log  logs/error.log  notice;
error_log  logs/error.log  info;

pid        logs/nginx.pid;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  pan.51xiongmao.cn www.pan.51xiongmao.cn;
        rewrite ^(.*)$ https://${server_name}$1 permanent;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        proxy_set_header X-Forwarded-For $remote_addr;

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

    # HTTPS server
    #
    server {
        listen       443 ssl;
        server_name  pan.51xiongmao.cn www.pan.51xiongmao.cn;

        ssl_certificate      /usr/local/nginx/ssl/51xiongmao.cn.crt;
        ssl_certificate_key  /usr/local/nginx/ssl/51xiongmao.cn.rsa;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location / {
            proxy_pass         http://127.0.0.1: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_read_timeout  1200s;

            # used for view/edit office file via Office Online Server
            client_max_body_size 0;
        }

        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  36000s;
            proxy_read_timeout  36000s;
            proxy_send_timeout  36000s;
            send_timeout  36000s;
         proxy_request_buffering off;
        }

        location /media {
            root /data/seafile-server-latest/seahub;
        }
    }
}

Tags:
One Comment

Add a Comment

您的电子邮箱地址不会被公开。