这里以https://i.hivps.cn直接访问Seafile为例
server {
    listen 80;
    server_name i.hivps.cn;
    rewrite ^ https://$http_host$request_uri? permanent;
  }
server {
    listen 443 ssl;
    ssl on;
    ssl_certificate fullchain.pem;
    ssl_certificate_key privkey.pem;
    server_name i.hivps.cn;
    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 /www/server/nginx/logs/seahub.access.log;
        error_log /www/server/nginx/logs/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;
    }

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

<p>

<img src="https://www.hivps.cn/wp-content/uploads/2017/06/452A4831-7583-4123-9863-FFA22CC15E81.jpg" alt="" width="2560" height="1600" class="alignnone size-full wp-image-460" /> 

</p>
<p>

<br />

</p>
<p>

<span style="color:#E53333;font-family:'Microsoft YaHei';font-size:18px;">补充:配置文件中的</span> 

</p>
<p>

<span class="pun" style="font-family:'Microsoft YaHei';font-size:18px;color:#E53333;">/</span><span class="pln" style="font-family:'Microsoft YaHei';font-size:18px;color:#E53333;">data</span><span class="pun" style="font-family:'Microsoft YaHei';font-size:18px;color:#E53333;">/</span><span class="pln" style="font-family:'Microsoft YaHei';font-size:18px;color:#E53333;">ifiles</span><span class="pun" style="font-family:'Microsoft YaHei';font-size:18px;color:#E53333;">/</span><span class="pln" style="font-family:'Microsoft YaHei';font-size:18px;color:#E53333;">seafile</span><span class="pun" style="font-family:'Microsoft YaHei';font-size:18px;color:#E53333;">-</span><span class="pln" style="font-family:'Microsoft YaHei';font-size:18px;color:#E53333;">server</span><span class="pun" style="font-family:'Microsoft YaHei';font-size:18px;color:#E53333;">-</span><span class="pln" style="font-family:'Microsoft YaHei';font-size:18px;color:#E53333;">latest</span><span class="pun" style="font-family:'Microsoft YaHei';font-size:18px;color:#E53333;">/</span><span class="pln" style="font-family:'Microsoft YaHei';font-size:18px;color:#E53333;">seahub 请自行替换为你的seahub所在目录,不然会CSS丢失</span> 

</p>

<span class="pln">location </span><span class="pun">/</span><span class="pln">media </span><span class="pun">{</span><span class="pln"> </span>
<span class="pln">root </span><span class="pun">/</span><span class="pln">data</span><span class="pun">/</span><span class="pln">ifiles</span><span class="pun">/</span><span class="pln">seafile</span><span class="pun">-</span><span class="pln">server</span><span class="pun">-</span><span class="pln">latest</span><span class="pun">/</span><span class="pln">seahub</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span>
<span class="pun"> </span>
<span class="pun"> </span>
<span style="color:#666600;">设置后,Seafile后台对应设置参考如下:</span>
<p>
</p>
Last modification:December 13th, 2017 at 11:43 pm