nginx

使用するWebサーバをnginxに切り替えます。また、サービスの再起動を行います。

Security Editionでは、NGINXでリバースプロキスを行い、Webサーバとアプリケーションを別のNGINXで動作させるnginxリバースプロキシ + nginxに切り替えます。また、サービスの再起動を行います。

Webサーバの違いについてはKUSANAGIのWebサーバ構成、または、KUSANAGI Security EditionのWebサーバ構成を参照してください。

使用例

kusanagi nginx --use nginx129
kusanagi nginx

オプション

(オプション指定なし)

httpd を使用している場合は、nginx に切り替えます。
既にnginx を起動しているときは、nginxを再起動します。

Security Editionでは、nginxリバースプロキシ + httpd を使用している場合は、nginxリバースプロキシ + nginx に切り替えます。
既にnginx を起動しているときは、nginxリバースプロキシとnginxを再起動します。

使用するNGINX

[--use {installed | nginx129 | nginx128}]
廃止オプション
--use nginx127 (9.8.1 および 10.3.1で廃止)
--use nginx126 (9.8.1 および 10.3.1で廃止)
--use nginx125 (9.6.8 および Security Editionで廃止)
--use nginx124 (9.6.8 および Security Editionで廃止)
--use nginx123 (9.4.5で廃止)
--use nginx122 (9.4.5で廃止)
--use nginx121 (9.2.10で廃止)
--use nginx120 (9.2.10で廃止)
--use nginx119 (9.0.12で廃止)
--use nginx118 (9.0.12で廃止)

デフォルト : installed

使用するNGINXのバージョンを指定します。それぞれ指定したときは以下のNGINXを起動します。

Security Editionでは、リバースプロキシとWebサーバ・アプリケーションのNGINXには同じバージョンが使用されます。
異なるバージョンを指定する場合はkusanagi proxyコマンドを使用してください。

--use、--reload、--test、--update-conf、--status、--showpath は同時に指定できません。

  • --use installed : 現在インストールされているNGINX
  • --use nginx129 : NGINX 1.29
  • --use nginx128 : NGINX 1.28
  • --use nginx127 (9.8.1 および 10.3.1で廃止) : NGINX 1.27
  • --use nginx126 (9.8.1 および 10.3.1で廃止) : NGINX 1.26
  • --use nginx125 (9.6.8 および Security Editonで廃止) : NGINX 1.25
  • --use nginx124 (9.6.8 および Security Editonで廃止) : NGINX 1.24
  • --use nginx123 (9.4.5で廃止) : NGINX 1.23
  • --use nginx122 (9.4.5で廃止) : NGINX 1.22
  • --use nginx121 (9.2.10で廃止) : NGINX 1.21
  • --use nginx120 (9.2.10で廃止) : NGINX 1.20
  • --use nginx119 (9.0.12で廃止) : NGINX 1.19
  • --use nginx118 (9.0.12で廃止) : NGINX 1.18

設定の再読み込み

[--reload]

既存のセッションを切断することなく設定を再読込します。
--use、--reload、--test、--update-conf、--status、--showpath は同時に指定できません。

設定ファイルのチェック

[--test]

設定ファイルのチェックのみを行います。
--use、--reload、--test、--update-conf、--status、--showpath は同時に指定できません。

設定ファイルの更新

廃止オプション
[--update-conf (Security Editionで廃止)]

NGINX 1.25.1の仕様に合わせて設定ファイルを更新します。
--use、--reload、--test、--update-conf、--status は同時に指定できません。

ステータスの表示

[--stauts]

NGINXのステータスを表示します。
--use、--reload、--test、--update-conf、--status、--showpath は同時に指定できません。

nginx コマンドのフルパスを表示

[--showpath]

nginx コマンドのフルパスを表示します。
--use、--reload、--test、--status、--showpath は同時に指定できません。

実行例

# kusanagi nginx
nginx: the configuration file /etc/opt/kusanagi/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/opt/kusanagi/nginx/nginx.conf test is successful
Removed /etc/systemd/system/multi-user.target.wants/httpd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service -> /usr/lib/systemd/system/nginx.service.
nginx completed.

Security Editionの場合
# kusanagi nginx
nginx: the configuration file /etc/opt/kusanagi/nginx129/nginx-proxy.conf syntax is ok
nginx: configuration file /etc/opt/kusanagi/nginx129/nginx-proxy.conf test is successful
nginx: the configuration file /etc/opt/kusanagi/nginx129/nginx-production.conf syntax is ok
nginx: configuration file /etc/opt/kusanagi/nginx129/nginx-production.conf test is successful
Removed "/etc/systemd/system/multi-user.target.wants/httpd24@production.service".
Created symlink /etc/systemd/system/multi-user.target.wants/nginx129@production.service -> /usr/lib/systemd/system/nginx129@.service.
nginx completed.

参考コラム

kusanagi nginx で HTTP/3 に対応する - KUSANAGI Tech Column

超高速CMS実行環境 KUSANAGI
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.