CentOS 7にApacheをインストールする方法
CentOS 7サーバーにApache 2.4をインストールする方法を説明します。安定したウェブサーバーを構築するための前提条件と手順を解説します。
Firefox Syncは、すべてのデバイスでデータと設定(ブックマーク、履歴、パスワード、開いているタブ、インストールされているアドオンなど)を共有できるブラウザ同期機能です。Mozillaは、独自の同期データをホストすることを好むユーザーや企業向けに、Firefox Syncで使用��る「同期サーバー」アプリケーションも提供しています。この記事では、Mozilla同期サーバーの設定方法を説明します。
システムを更新します。
sudo yum check-update
同期サーバーを構築して実行するには、次のパッケージをインストールする必要があります。
Mecurial
sqlite3
git
Python 2.6.6
Python 2.6.6 virtualenv
Python 2.6.6 SetupTools
Python 2.6.6 Developer Tools
Mercurialの最新バージョンをインストールします。
sudo yum install mercurial
必要な開発ツールとライブラリをインストールします。
yum groupinstall 'Development Tools' 'Development Libraries'
yum install tk-devel libjpeg-devel mysql-devel python-devel httpd-devel zlib-devel bzip2-devel
SQLite3をインストールします。
sudo yum install sqlite
Python 2.6.6をインストールしてビルドします。
cd $home
sudo wget http://python.org/ftp/python/2.6.6/Python-2.6.6.tgz
sudo tar xzvf Python-2.6.6.tgz
cd $home/Python-2.6.6
sudo ./configure --prefix=/opt/python2.6 --enable-thread --enable-shared --enable-unicode=ucs4
sudo make
sudo make install
同期サーバーのGitリポジトリのクローンを作成し、フォルダーに移動します。
git clone https://github.com/mozilla-services/syncserver
cd syncserver
依存関係をダウンロードしてコードをコンパイルするビルドコマンドを実行します。
make build
同期サーバーを起動し、正しく動作することを確認します。
bin/paster serve development.ini
次のようなものが表示されます。
Starting server in PID 5952.
serving on 0.0.0.0:5000 view at http://127.0.0.1:5000
同期サーバーの設定は非常に簡単./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
注:デフォルト値のpublic_url
、はhttp://localhost:5000/
、ローカルマシンでのテスト用に機能します。
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 &
これにより、構成ファイルの場所を選択できます。また、引数を指定します--threads 4
。これにより、同期サーバーにより多くの電力を割り当てることができます。
インスタンスが起動するたびにサーバーを起動するには、次のcrontab -e
コマンドを入力して、crontabに次の行を追加できます。
@reboot ./path/to/syncserver/local/bin/gunicorn --paste /path/to/syncserver/syncserver.ini &
WSGI
プロトコルと互換性のあるさまざまなWebサーバーを使用できます。例えば:
Nginx
uWSGIで。Apache
mod_wsgiと組み合わせる。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ユーザーは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;
}
インストール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 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
CentOS 7サーバーにApache 2.4をインストールする方法を説明します。安定したウェブサーバーを構築するための前提条件と手順を解説します。
CentOS 7にSeafileサーバーをインストールする方法。Seafile(コミュニティバージョン)は、ownCloudに似た無料のオープンソースファイル同期および共有ソリューションです。
CentOS 7にGraylogサーバーをインストールし、ログ管理を行う方法を学びます。
CentOS 7サーバーにApache 2.4をインストールする方法を説明します。安定したウェブサーバーを構築するための前提条件と手順を解説します。
FreeBSD 11.1におけるBlacklistdのインストール方法について詳しく解説します。この方法を通じて、強力なセキュリティ対策を実装できます。
サーバーマネージャーを使用して、Windows Serverの管理が向上します。セキュリティリスクを軽減し、効率的な管理を実現します。
CentOS 7にSeafileサーバーをインストールする方法。Seafile(コミュニティバージョン)は、ownCloudに似た無料のオープンソースファイル同期および共有ソリューションです。
Snortは無料のネットワーク侵入検知システムです。最新の方法で、SnortをDebianにインストールし、設定する手順を紹介します。ネットワークのセキュリティを強化しましょう。
CentOS 7にGraylogサーバーをインストールし、ログ管理を行う方法を学びます。
WindowsサーバーでWebサイトを実行している場合、電子メールも受信できるようにするためにhMailServerを使用する方法を解説します。
FiveMサーバーをUbuntu 19.04にインストールするための詳細なガイド。必要条件からインストール、起動、トラブルシューティングまで、すべてのステップを含みます。
Debian 10にWebDAVをデプロイする方法を学び、WsgiDAVとSSL証明書で安全な接続を実現しましょう。
ヘルスケアにおけるAIは、過去数十年から大きな飛躍を遂げました。したがって、ヘルスケアにおけるAIの未来は、日々成長を続けています。