Skip to content

nginx代理gofastdfs的https设置

ah edited this page May 20, 2019 · 5 revisions

修改 nginx.conf

  • 需要先自己申请好https证书

  • 安装godfs,启动

  • 以下为关键代码

      upstream godfs {
         server 127.0.0.1:8080;
      }
    

代理到https

    server  {
    listen      443 ssl http2;
    server_name  xxxx.com;

    add_header Strict-Transport-Security 'max-age=31536000';
    add_header X-Frame-Options DENY;
    add_header X-Content-Type-Options nosniff;

    ssl_certificate fullchain.cer;
    ssl_certificate_key xxx.key;
    ssl_session_tickets on;
    ssl_session_timeout 1d;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;

    charset utf-8;
    proxy_connect_timeout 180;
    proxy_send_timeout 180;
    proxy_read_timeout 180;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarder-For $remote_addr;

    location / {
        proxy_pass http://godfs;
    }
    }
  • 集群配置可以直接使用https进行设置,如你已经配置好 https://files1.xxx.com https://files2.xxx.com https://files3.xxx.com 三台服务器,分别启动 gofastdfs ,然后分别在三台服务器编辑配置文件: vi cfg\cfg.json

      "peers": ["https://files1.xxx.com","https://files2.xxx.com","https://files3.xxx.com"]
    
  • https 集群就配置好了

Clone this wiki locally