環境:Centos 7.5 x64 docker Version: 19.03.4 date:2019-11-08
說明:docker部署seafile,不想用443端口,改為600端口,安裝好登錄卻報以下錯誤
Forbidden (403)
CSRF verification failed. Request aborted.
More information is available with DEBUG=True.
解決方法:
啟動docker容器seafile,並修改docker容器內的nginx配置
路徑:/templates/seafile.nginx.conf.template(這個是nginx配置文件模板,每次啟動自動生成nginx的配置)
server {
{% if https -%}
listen 443;
ssl on;...........
listen 80;
{% endif -%}
server_name {{ domain }};
client_max_body_size 10m;
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_read_timeout 310s;
{% if https -%}
proxy_set_header Host $host:600; #在host后面加一個:600端口(600為https對外端口,根據自己的需求更改)
{% else -%}
proxy_set_header Host $host;
{% endif -%}
}
保存並退出容器
重啟docker容器
docker restart seafile
說明:重啟容器,docker會根據文件/templates/seafile.nginx.conf.template,自動生成/etc/nginx/sites-enabled/seafile.nginx.conf文件
成功!