OpenLiteSpeed をアップデートしたら管理画面が認証不能になった場合の対処法

OpenLiteSpeed Enterprise Linux 9
このサイトはアフィリエイト広告(Amazonアソシエイト含む)を掲載しています。
スポンサーリンク
Red Hat Enterprise Linux 9 に http/3 対応のウェブサーバー(OpenLiteSpeed)を構築する
前回からだいぶ間が空いてしまいましたが、ConoHa の VPS にインストールした RHEL9 上にウェブサーバーを導入していきます。ちょうど最近 OpenLiteSpeed のリポジトリに CentOS 9 用が追加されていましたので、...

以前構築した OpenLiteSpeed ウェブサーバーが、dnf-automatic で夜間自動アップデートされたのですが、ウェブサイトにアクセスすると 503 エラー(Service Unavailable)を返して閲覧できない状態になっていました。

503 Service Unavailable

この 503 エラーに関しては OLS のサービスを再起動(systemctl restart lsws.service)する事で、すぐに復旧する事ができました。

詳細を確認するため OLS の管理画面にアクセスしようとしたところ、設定した管理者パスワードを正しく入力しても Invalid credentials が表示され、ログインできない状態になっていました。

環境

  • OS: AlmaLinux release 9.6 (Sage Margay)
  • ウェブサーバー: OpenLiteSpeed
    • アーキテクチャー: x86_64
    • アップデート後のバージョン: 1.8.4-4.el9
    • リポジトリ: litespeed-update
  • ホスティング: ConoHa VPS(メモリ 2GB)
ConoHa VPS

対処法

OLS 管理画面のログ(/usr/local/lsws/admin/logs/error.log)を確認したところ、/usr/local/lsws/admin/conf/htpasswd が見つからないというエラーが記録されていました。

2025-09-26 10:35:54.465006 [NOTICE] [1336] [xxx.xxx.xxx.xxx:XXXXX:HTTP2-X#_AdminVHost] [STDERR] PHP Warning:  fopen(/usr/local/lsws/admin/conf/htpasswd): failed to open stream: No such file or directory in /usr/local/lsws/admin/html.open/lib/CAuthorizer.php on line 237
2025-09-26 10:35:54.466218 [NOTICE] [1336] [xxx.xxx.xxx.xxx:XXXXX:HTTP2-X#_AdminVHost] [STDERR] [WebAdmin Console] Failed Login Attempt - username:admin ip:xxx.xxx.xxx.xxx url:

ディレクトリのファイル一覧を確認しても、htpasswd がありません。

ls -la /usr/local/lsws/admin/conf/
(out) total 88
(out) drwx------ 2 lsadm lsadm  4096 Sep 26 06:51 .
(out) drwxr-xr-x 9 root  root   4096 Sep 26 06:50 ..
(out) -rw-r--r-- 1 lsadm lsadm   681 Apr 15  2024 admin_config.conf
(out) -rw-r--r-- 1 lsadm lsadm   798 Feb  2  2024 admin_config.conf.bak
(out) -rw-r--r-- 1 lsadm lsadm   495 Sep 26 10:24 admin_config.conf.txt
(out) -rw-r--r-- 1 lsadm lsadm   681 Apr 15  2024 admin_config.conf0
(out) -rw------- 1 lsadm lsadm    41 Aug 22 00:19 htpasswd.rpmnew
(out) -rw------- 1 lsadm lsadm    41 Feb  2  2024 htpasswd.rpmsave
(out) -rw------- 1 lsadm lsadm   529 Sep 25 11:23 jcryption_keypair
(out) -rw------- 1 lsadm lsadm 38186 Sep 25 11:23 php.ini
(out) -rw-r--r-- 1 lsadm lsadm  2077 Sep 11 17:58 quic-cloud-ips
(out) -r-------- 1 lsadm lsadm  1623 Feb  2  2024 webadmin.crt
(out) -r-------- 1 lsadm lsadm  1704 Feb  2  2024 webadmin.key

管理者パスワードを再設定

admpass.sh を実行して管理者パスワードを作り直します。

/usr/local/lsws/admin/misc/admpass.sh
(out) 
(out) Please specify the user name of administrator.
(out) This is the user name required to login the administration Web interface.
(out) 
(out) User name [admin]:(空エンター)
(out) 
(out) Please specify the administrator's password.
(out) This is the password required to login the administration Web interface.
(out) 
(out) Password:(パスワードを入力)
(out) Retype password:(パスワードを再入力)
(out) Administrator's username/password is updated successfully!

作成された htpasswd のパーミッションを修正します。

chown lsadm:lsadm /usr/local/lsws/admin/conf/htpasswd
chmod 600 /usr/local/lsws/admin/conf/htpasswd

htpasswd を再作成したところ、無事 OLS の管理画面にログインできるようになりました。

ConoHa VPS

コメント

タイトルとURLをコピーしました