在按照官网的nginx配置使用https 发现问题。
首次访问https 302 跳转到 http 登录页面 这会引发一个问题
有些情况下 服务器不允许 http 80端 口开启服务 只允许https 开启端口服务
所以在上述问题中 用户第一次访问https站点会跳至 http访问 这会引发 无法访问的情况!
再经过nginx的调试后 加入 proxy_set_header Host $host:443; 配置可解决问题
server {
listen 443 ssl;
server_name seafile.xxx.com;
server_tokens off;
ssl_certificate keys/jkweixin.com/jkweixin.com.crt;
ssl_certificate_key keys/jkweixin.com/jkweixin.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;
proxy_set_header X-Forwarded-For $remote_addr;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host:443;
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;
proxy_read_timeout 1200s;
# used for view/edit office file via Office Online Server
client_max_body_size 0;
access_log logs/seahub.access.log;
error_log logs/nginx/seahub.error.log;
}
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_set_header X-Forwarded-Proto https;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
proxy_send_timeout 36000s;
send_timeout 36000s;
}
location /media {
root /data/seafile/seafile-server-latest/seahub;
}
}