Debian 9またはUbuntu 16.04でFirefox Sync Serverをセットアップする

Firefox Syncは、すべてのデバイスでデータと設定(ブックマーク、履歴、パスワード、開いているタブ、インストールされているアドオンなど)を共有できるブラウザ同期機能です。Mozillaは、独自の同期データをホストすることを好むユーザーや企業向けに、Firefox Syncで使用する「同期サーバー」アプリケーションも提供しています。この記事では、Mozilla同期サーバーの設定方法を説明します。

前提条件

  • 新しくデプロイされたVultr Debian 8、Debian 9、またはUbuntu 16.04サーバーインスタンス。
  • sudoのユーザー

必要なパッケージをインストールする

システムを更新します。

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

同期サーバーを構築して実行するには、次のパッケージをインストールする必要があります。

  • python-dev
  • git
  • build-essential (C ++コンパイラ、GCCコンパイラ、makeおよびその他の必要なツール)。
  • sqlite3(の代わりにMySQLデータベースを使用するSQLite場合は、sqlite3パッケージをmariadb-serverまたはで置き換えることができますmysql-server)。
  • nginx(ウェブサーバー。apache2またはから使用するウェブサーバーを選択するのはあなた次第ですnginx)。

パッケージをインストールします。

sudo apt-get install -y git git-core python-dev python-virtualenv build-essential sqlite3 nginx

サーバーの構築

次のコマンドを入力してフォルダーを入力することにより、同期サーバーのGitリポジトリのクローンを作成します。

git clone https://github.com/mozilla-services/syncserver
cd syncserver

依存関係をダウンロードしてコードをコンパイルするビルドコマンドを実行します。

make build

同期サーバーの構成

同期サーバーの設定は非常に簡単./syncserver.iniです。設定ファイル()で変更するパラメーターはほんのわずかです。

お好みのテキストエディタ(たとえばnano ./syncserver.ini)で構成ファイルを開きます。

[server:main]
use = egg:gunicorn
host = 0.0.0.0
port = 5000
workers = 1
timeout = 30

[app:main]
use = egg:syncserver

[syncserver]
# This must be edited to point to the public URL of your server,
# i.e. the URL as seen by Firefox.
public_url = http://localhost:5000/

# This defines the database in which to store all server data.
#sqluri = sqlite:////tmp/syncserver.db

# This is a secret key used for signing authentication tokens.
# It should be long and randomly-generated.
# The following command will give a suitable value on *nix systems:
#
#    head -c 20 /dev/urandom | sha1sum
#
# If not specified then the server will generate a temporary one at startup.
#secret = INSERT_SECRET_KEY_HERE

# Set this to "false" to disable new-user signups on the server.
# Only request by existing accounts will be honoured.
# allow_new_users = false

# Set this to "true" to work around a mismatch between public_url and
# the application URL as seen by python, which can happen in certain reverse-
# proxy hosting setups.  It will overwrite the WSGI environ dict with the
# details from public_url.  This could have security implications if e.g.
# you tell the app that it's on HTTPS but it's really on HTTP, so it should
# only be used as a last resort and after careful checking of server config.
force_wsgi_environ = false

[browserid]
# Uncomment and edit the following to use a local BrowserID verifier
# rather than posting assertions to the mozilla-hosted verifier.
# Audiences should be set to your public_url without a trailing slash.
#backend = tokenserver.verifiers.LocalVerifier
#audiences = https://localhost:5000

# By default, syncserver will accept identity assertions issues by
# any server. You can restrict this by setting the below to a list
# of allowed issuer domains.
#allowed_issuers = www.mysite.com myfriendsdomain.org

サーバーのアドレスは、パラメーターを介して指定する必要がありますpublic_url

public_url = http://fsync.example.com

「http:// localhost:5000 /」のデフォルト値はpublic_url、ローカルマシンでのテスト目的で機能します。

ではsqluriオプション、我々は、コメントを解除し、場所を入れたりしますURIそれは、サーバーがデータベースに接続して情報を保存することができます:

sqluri = sqlite:////path/to/database/file.db

別のタイプのDBを使用する場合:

sqluri = pymysql://username:[email protected]/sync

secret」パラメーターの場合、認証トークンの秘密鍵を生成する必要があります。

head -c 20 /dev/urandom | sha1sum

シークレットパラメーターの行のコメントを外し、返された文字列をシークレットパラメーターにコピーして貼り付けます。

secret = db8a203aed5fe3e4594d4b75990acb76242efd35

このパラメーターに何も入力しないと、サーバーによって生成されますが、サーバーを再始動するたびに異なります。

allow\_new\_users」パラメーターのコメントを外して、trueアカウントがサーバーに初めて接続できるように設定します。

allow_new_users = true

次に、「audiences」パラメーターを変更しpublic_uri、行のコメントを解除することを忘れずに、「」パラメーターと同じものを配置します。

audiences = http://fsync.example.com

最後に、次の行をファイルの最後に追加します。

forwarded_allow_ips = *

この行は、エラーメッセージと承認の問題を回避するのに役立ちます。

同期サーバーの開始

同期サーバーを起動するには、次のコマンドを起動します。

./path/to/syncserver/local/bin/gunicorn --threads 4 --paste /path/to/syncserver/syncserver.ini &

...またはこれ:

make serve &

最初のオプションでは、構成ファイルの場所を選択できます。また、引数を指定--threads 4して、同期サーバーにより多くの電力を割り当てることができます。

インスタンスが起動するたびにサーバーを起動するには、次のcrontab -eコマンドを入力して、crontabに次の行を追加できます。

@reboot ./path/to/syncserver/local/bin/gunicorn --paste /path/to/syncserver/syncserver.ini &

Webサーバーの構成

WSGIプロトコルと互換性のあるさまざまなWebサーバーを使用できます。例えば:

  • Nginx uWSGIで。
  • Apache mod_wsgiと組み合わせる。

Nginx

Nginxの場合、次に示すように、Nginxの組み込みプロキシを使用する必要があります。

server {
        listen  80;
        server_name fsync.example.com;

        location / {
                proxy_set_header Host $http_host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_redirect off;
                proxy_read_timeout 120;
                proxy_connect_timeout 10;
                proxy_pass http://127.0.0.1:5000/;
        }
}

Nginx + uWSGI

NginxユーザーはWSGIソケットのみを使用できます。

uWSGIピップ経由でインストール:

pip install uwsgi

uWSGIソースtarballをダウンロードしてインストールします。

wget https://projects.unbit.it/downloads/uwsgi-latest.tar.gz
tar zxvf uwsgi-latest.tar.gz
cd <dir>
make

ビルド後uwsgi、現在のディレクトリにバイナリが作成されます。

インストールしたら、次のオプションで起動します。

uwsgi --plugins python27 --manage-script-name \
--mount /<location>=/path/to/syncserver/syncserver.wsgi \
--socket /path/to/uwsgi.sock

次に、次のNginx構成を使用します。

location /<location>/ {
  include uwsgi_params;
  uwsgi_pass unix:/path/to/uwsgi.sock;
}

Apache

インストールmod_wsgi

apt-get install libapache2-mod-wsgi

次に、次の仮想ホストを使用します。

<VirtualHost *:80>
  ServerName sync.example.com
  DocumentRoot /path/to/syncserver
  WSGIProcessGroup sync
  WSGIDaemonProcess sync user=sync group=sync processes=2 threads=25 python-path=/path/to/syncserver/local/lib/python2.7/site-packages/
  WSGIPassAuthorization On
  WSGIScriptAlias / /path/to/syncserver/syncserver.wsgi
  CustomLog /var/log/apache2/sync.example.com-access.log combined
  ErrorLog  /var/log/apache2/sync.example.com-error.log
</VirtualHost>

クライアントを構成する(Firefox)

サーバーをインストールして構成したら、新しい同期サーバーと通信するようにデスクトップFirefoxクライアントを構成する必要があります。始める前に、Firefox Sync Serverに既に接続している場合は、ログアウトする必要があります。そうしないと、新しいサーバーへの接続が機能しない可能性があります。

まず、新しいタブを開き、次のアドレスを入力します。

about:config

検索バーにidentity.sync.tokenserver.uri値を入力し、次のパスを持つサーバーのURLに変更しますtoken/1.0/sync/1.5

http://sync.example.com/token/1.0/sync/1.5


Leave a Comment

CentOS 7にApacheをインストールする方法

CentOS 7にApacheをインストールする方法

CentOS 7サーバーにApache 2.4をインストールする方法を説明します。安定したウェブサーバーを構築するための前提条件と手順を解説します。

FreeBSD 11.1にBlacklistdをインストールする方法

FreeBSD 11.1にBlacklistdをインストールする方法

FreeBSD 11.1におけるBlacklistdのインストール方法について詳しく解説します。この方法を通じて、強力なセキュリティ対策を実装できます。

Windows Serverのサーバーマネージャーを使用した複数サーバーの管理

Windows Serverのサーバーマネージャーを使用した複数サーバーの管理

サーバーマネージャーを使用して、Windows Serverの管理が向上します。セキュリティリスクを軽減し、効率的な管理を実現します。

CentOS 7にSeafileサーバーをインストールする方法

CentOS 7にSeafileサーバーをインストールする方法

CentOS 7にSeafileサーバーをインストールする方法。Seafile(コミュニティバージョン)は、ownCloudに似た無料のオープンソースファイル同期および共有ソリューションです。

DebianでSnortを設定する方法

DebianでSnortを設定する方法

Snortは無料のネットワーク侵入検知システムです。最新の方法で、SnortをDebianにインストールし、設定する手順を紹介します。ネットワークのセキュリティを強化しましょう。

CentOS 7にGraylogサーバーをインストールする方法

CentOS 7にGraylogサーバーをインストールする方法

CentOS 7にGraylogサーバーをインストールし、ログ管理を行う方法を学びます。

WindowsでhMailServerを使用してメールサーバーを構築する

WindowsでhMailServerを使用してメールサーバーを構築する

WindowsサーバーでWebサイトを実行している場合、電子メールも受信できるようにするためにhMailServerを使用する方法を解説します。

Ubuntu 19.04にFiveMサーバーをインストールする方法

Ubuntu 19.04にFiveMサーバーをインストールする方法

FiveMサーバーをUbuntu 19.04にインストールするための詳細なガイド。必要条件からインストール、起動、トラブルシューティングまで、すべてのステップを含みます。

WsgiDAVを使用してDebian 10にWebDAVをデプロイする

WsgiDAVを使用してDebian 10にWebDAVをデプロイする

Debian 10にWebDAVをデプロイする方法を学び、WsgiDAVとSSL証明書で安全な接続を実現しましょう。

ヘルスケア2021における人工知能の影響

ヘルスケア2021における人工知能の影響

ヘルスケアにおけるAIは、過去数十年から大きな飛躍を遂げました。したがって、ヘルスケアにおけるAIの未来は、日々成長を続けています。