13,228
回編集
| 162行目: | 162行目: | ||
<u>WEBrickは開発時に使用すものであり、通常の運用には適していないため、動作確認以外には使用しないこと。</u><br> | <u>WEBrickは開発時に使用すものであり、通常の運用には適していないため、動作確認以外には使用しないこと。</u><br> | ||
<u>本番運用においては、Passenger(mod_rails)、FCGI、Rackサーバ(Unicorn, Thin, Puma,hellip等)の使用を推奨する。</u><br> | <u>本番運用においては、Passenger(mod_rails)、FCGI、Rackサーバ(Unicorn, Thin, Puma,hellip等)の使用を推奨する。</u><br> | ||
<br><br> | |||
== NginXとの連携 == | |||
==== NginXのインストール ==== | |||
NginXのビルドに必要なライブラリをインストールする。<br> | |||
sudo zypper install libxslt-devel pcre2-devel gd-devel | |||
libcurl-devel # Passengerを使用する場合 | |||
kernel-source kernel-devel # AIOを使用する場合 | |||
<br> | |||
必要ならば、[https://www.openssl.org/source/ OpenSSLの公式Webサイト]にアクセスして、OpenSSL(1.X.Y)のソースコードをダウンロードする。<br> | |||
ダウンロードしたファイルを解凍する。<br> | |||
tar xf openssl-<バージョン> | |||
<br> | |||
* Digest認証モジュールを使用する場合 | |||
*: NginXのソースコードと一緒に配布されていないため、別途インストールする必要がある。<br> | |||
*: [https://github.com/atomx/nginx-http-auth-digest Digest認証モジュールのGithub]にアクセスして、ソースコードをダウンロードする。<br> | |||
*: ダウンロードしたファイルを解凍する。<br> | |||
*: <code>tar xf nginx-http-auth-digest-<バージョン>.tar.gz</code> | |||
*: <br> | |||
*: または、<code>git clone</code>コマンドを実行して、ソースコードをダウンロードする。<br> | |||
*: <code>git clone https://github.com/atomx/nginx-http-auth-digest.git</code> | |||
<br> | |||
[https://nginx.org/en/download.html NginXの公式Webサイト]にアクセスして、NginXのソースコードをダウンロードする。<br> | |||
ダウンロードしたファイルを解凍する。<br> | |||
tar xf nginx-<バージョン>.tar.xz | |||
<br> | |||
NginXおよびNginX向けPassangerをビルドおよびインストールする。<br> | |||
passenger-install-nginx-module | |||
<br> | |||
手順が表示されるので、[Enter]キーを押下して次へ進む。<br> | |||
ビルド環境の選択では、[Ruby]を選択して、[Enter]キーを押下する。<br> | |||
<br> | |||
NginXのソースコードがあるディレクトリを入力して、[Enter]キーを押下する。<br> | |||
次に、NginXのインストールディレクトリを入力して、[Enter]キーを押下する。<br> | |||
<br> | |||
最後に、<code>configure</code>スクリプトのオプションを、以下に示すように指定する。<br> | |||
改行文字(<code>\</code>)が使用できないことに注意する。<br> | |||
--sbin-path=/<NginXのインストールディレクトリ>/sbin/nginx --conf-path=/<NginXのインストールディレクトリ>/etc/nginx.conf --pid-path=/<NginXのインストールディレクトリ>/nginx.pid --modules-path=/<NginXのインストールディレクトリ>/modules/ --error-log-path=/<NginXのインストールディレクトリ>/log/error.log --http-log-path=/<NginXのインストールディレクトリ>/log/access.log --lock-path=/<NginXのインストールディレクトリ>/nginx.lock --http-client-body-temp-path=/<NginXのインストールディレクトリ>/tmp --http-proxy-temp-path=/<NginXのインストールディレクトリ>/proxy --http-fastcgi-temp-path=/<NginXのインストールディレクトリ>/fastcgi --http-uwsgi-temp-path=/<NginXのインストールディレクトリ>/uwsgi --http-scgi-temp-path=/<NginXのインストールディレクトリ>/scgi --with-perl_modules_path=/<NginXのインストールディレクトリ>/Perl --with-threads --with-file-aio --with-pcre --with-pcre-jit --with-http_v2_module --with-http_ssl_module --with-http_addition_module --with-http_realip_module --with-http_flv_module --with-http_random_index_module --with-http_degradation_module --with-http_slice_module --with-http_dav_module --with-http_mp4_module --with-http_xslt_module --with-http_xslt_module=dynamic --with-http_image_filter_module --with-http_image_filter_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_secure_link_module --with-http_stub_status_module --with-http_sub_module --with-http_perl_module --with-http_perl_module=dynamic --with-mail --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_ssl_preread_module --with-compat --user=<任意のユーザ名 例. nginx> --group=<任意のグループ名 例. nginx> --add-module=<Digest認証モジュールのソースコードがあるディレクトリ> | |||
<br> | |||
Passengerのビルドが開始する。<br> | |||
ビルドに成功した時、<u>Passengerを組み込まれた</u>nginx.confの設定が表示される。<br> | |||
<syntaxhighlight lang="nginx"> | |||
http { | |||
# ...略 | |||
passenger_root /<NginX向けPassangerのインストールディレクトリ>/passenger-6.0.17; | |||
passenger_ruby /<Rubyのインストールディレクトリ>/bin/ruby-3_0; | |||
# ...略 | |||
} | |||
</syntaxhighlight> | |||
<br><br> | <br><br> | ||