如何通过 ssl 运行 BitTorrent Sync Web 浏览器 gui

lin*_*dhe 5 server sync ssl bittorrent https

我已经在我的 Ubuntu 服务器上安装了 BitTorrent Sync,但注意到 web gui 不使用 ssl 进行登录(https://server:8888/guihttp://server:8888/gui不起作用)。这既用于登录,也用于登录时使用 gui。

有什么办法可以强制它改用 ssl 吗?

Ged*_*rox 5

简单的方法

使用btsync配置来实现这一点,请参阅./btsync --dump-sample-config配置键“force_https”、“ssl_certificate”、“ssl_private_key”。

即使这看起来更简单,我也不喜欢该btsync用户有权访问证书文件。这就是为什么我仍然更喜欢下一个方法。

艰辛的道路

我在cyberciti.biz/faq/howto-linux-unix-setup-nginx-ssl-proxy中找到了使用nginx作为代理服务器的解决方案。在我的 ubuntu 服务器安装上成功安装和配置。

进一步的步骤假设您已在目录/etc/nginx/certs/(ssl.crtssl.key) 中创建 SSL 证书。

安装 nginx

sudo apt-get install nginx
Run Code Online (Sandbox Code Playgroud)

(可选)停用默认配置

sudo rm /etc/nginx/sites-enabled/default
Run Code Online (Sandbox Code Playgroud)

/etc/nginx/sites-available/proxy内容中创建代理配置

server {
    ### server port and name ###
    listen          443;
    ssl             on;
    server_name     your-server-name.com;

    ### SSL log files ###
    access_log      /var/log/nginx/ssl-access.log;
    error_log       /var/log/nginx/ssl-error.log;

    ### SSL cert files ###
    ssl_certificate      /etc/nginx/certs/ssl.crt;
    ssl_certificate_key  /etc/nginx/certs/ssl.key;

    ### Add SSL specific settings here ###

    ssl_protocols        SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers RC4:HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;
    keepalive_timeout    60;
    ssl_session_cache    shared:SSL:10m;
    ssl_session_timeout  10m;

    ### We want full access to SSL via backend ###
    location / {
            proxy_pass  http://{destination-host}:{destination-port};

            ### force timeouts if one of backend is died ##
            proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

            ### Set headers ####
            proxy_set_header        Accept-Encoding   "";
            proxy_set_header        Host            $host;
            proxy_set_header        X-Real-IP       $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

            ### Most PHP, Python, Rails, Java App can use this header ###
            #proxy_set_header X-Forwarded-Proto https;##
            #This is better##
            proxy_set_header        X-Forwarded-Proto $scheme;
            add_header              Front-End-Https   on;


            ### By default we don't want to redirect it ####
            proxy_redirect     off;
  }

}
Run Code Online (Sandbox Code Playgroud)

变化值your-server-name.com{destination-host}{destination-port}和其他值相应。

启用配置

sudo ln -s /etc/nginx/sites-available/proxy /etc/nginx/sites-enabled/proxy  
Run Code Online (Sandbox Code Playgroud)

重新开始 nginx

sudo service nginx restart
Run Code Online (Sandbox Code Playgroud)