docker安裝seafile出現CSRF verification failed. Request aborted.解決方法


環境: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文件

成功! 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM