Nodebb登陆注册提示错误:{"meta":"invalid csrf token"}



  • 昨天站长将服务器重新安装了一下!整个社区网站重新部署了一次!还算顺利!

    为了提高访问速度,nodebb起了3个进程!

    参考文章:https://www.kancloud.cn/a632079/nodebb-cn/379356

    直接在nodebb的 config.js文件中新增一行

    {
        "port": ["4567", "4568", "4569"]  //这将启动3个进程,分别监听这3个端口
    }
    

    下面是我的Nginx配置信息!
    最后一行是解决这个错误的代码!大家可以参考一下!

    upstream io_nodes {
        ip_hash;
        server 127.0.0.1:4567;
        server 127.0.0.1:4568;
        server 127.0.0.1:4569;
    }
    
    server {
      listen 80;
      listen 443 ssl http2;
      ssl_certificate /usr/local/nginx/conf/ssl/jike.info.crt;
      ssl_certificate_key /usr/local/nginx/conf/ssl/jike.info.key;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
      ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
      ssl_prefer_server_ciphers on;
      ssl_session_timeout 10m;
      ssl_session_cache builtin:1000 shared:SSL:10m;
      ssl_buffer_size 1400;
      add_header Strict-Transport-Security max-age=15768000;
      ssl_stapling on;
      ssl_stapling_verify on;
      server_name jike.info;
      access_log /data/wwwlogs/jike.info_nginx.log combined;
      if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
    
      include /usr/local/nginx/conf/rewrite/other.conf;
      #error_page 404 /404.html;
      #error_page 502 /502.html;
    
      # Socket.io Support
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
    
      location @nodebb {
          proxy_pass http://io_nodes;
      }
    
      location ~ ^/assets/(.*) {
            root /data/wwwroot/nodebb/;
            try_files /build/public/$1 /public/$1 @nodebb;
      }
    
      location /plugins/ {
            root /data/wwwroot/nodebb/build/public/;
            try_files $uri @nodebb;
      }
    
      location / {
            proxy_pass http://io_nodes;
            proxy_redirect off;
            proxy_set_header X-Forwarded-Proto $scheme; #新增这一行能解决 invalid csrf token 错误!
      }
    }
    
    

登录后回复
 

Powered by NodeBB © 2019 JIKE.info All Rights Reserved Accelerated by 腾讯云 . 赣ICP备17000821号-1