0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

LiteSpeed インストール 【忘備録】

Last updated at Posted at 2023-02-06

参考(この忘備録は下記のURLの内容に手を加えたものです)

基本パッケージのインストール
開発ツールなど、基本的なパッケージをインストールしておきます。

yum -y groupinstall base
yum -y groupinstall development
yum -y groupinstall network-tools

LiteSpeed リポジトリのインストール
LiteSpeedリポジトリが依存する EPELリポジトリをインストールします。

yum -y install epel-release

LiteSpeedリポジトリをインストールします。

rpm -Uvh 【URI】 URIは http://rpms.litespeedtech.com/centos/ から最新のrpmを

今回の場合は

rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.3-1.el8.noarch.rpm

LiteSpeedリポジトリからは、LiteSpeed Web Server の他に PHP(5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2)もインストールできます。最新版も含め PHP の各種バージョンがインストールできるのは便利ですね。

yum list ls*
(略)
lsphp72.x86_64 7.2.5-1.el7.centos litespeed
lsphp72-bcmath.x86_64 7.2.5-1.el7.centos litespeed
lsphp72-common.x86_64 7.2.5-1.el7.centos litespeed

参考資料:litespeed_wiki:php:rpm [LiteSpeed Wiki]

LiteSpeed Web Server のインストール
LiteSpeed Web Server をインストールします。

yum -y install openlitespeed

RHEL9の場合
sudo wget -O - https://repo.litespeed.sh | sudo bash
dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm
yum install openlitespeed -y

CentOS7では「/usr/local/lsws」に LiteSpeed Web Server がインストールされます。

LiteSpeed Web Server の起動と自動起動設定
CentOS7 では起動操作や自動起動の設定は一般的に systemctl コマンドを使いますが、LiteSpeed はなつかしの service コマンドを使います。(LiteSpeed インストールすると起動処理と自動起動設定が自動で行われています)

service lsws help

Usage: {start|stop|restart|reload|condrestart|try-restart|status|help}

start – start web server
stop – stop web server
restart – gracefully restart web server with zero down time
reload – same as restart
condrestart – gracefully restart web server if server is running
try-restart – same as condrestart
status – show service status
help – this screen

起動

service lsws start

RHEL9の場合 systemctl enable lsws

停止

service lsws stop

自動起動ON

chkconfig lsws on

自動起動OFF

chkconfig lsws off

自動起動の設定確認

chkconfig –list lsws
(略)
lsws 0:off 1:off 2:on 3:on 4:on 5:on 6:off

firewalld設定
HTTP(80/tcp) と HTTPS(443/tcp) を許可します。

firewall-cmd –permanent –zone public –add-port 80/tcp
firewall-cmd –permanent –zone public –add-port 443/tcp

LiteSpeed Web Server の管理画面への接続ポートも許可しておきます。(管理画面のユーザー名とパスワードは必ず変更してください)

firewall-cmd –permanent –zone public –add-port 7080/tcp

RHEL9の場合 firewall-cmd --permanent --add-port={80/tcp,443/tcp,7080/tcp}

設定を読込みます。

firewall-cmd –reload

RHEL9の場合 firewall-cmd --reload

・設定を確認します
firewall-cmd –list-ports –zone=public
—–(以下の表示があればOK)—–

80/tcp 443/tcp 7080/tcp

管理画面のユーザー名とパスワードの変更
LiteSpeed Web Server の設定は基本的に Webコンソールから行います。不正アクセスされる可能性もありますので、管理画面へのユーザー名は必ず変更し、強度の高いパスワードを設定しておきましょう。

ユーザー名とパスワードの変更は LiteSpeed Web Server 付属の admpass.sh スクリプトで行います。

$ sudo /usr/local/lsws/admin/misc/admpass.sh
Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]: tomoyan596 <- 管理者ユーザーを入力

Please specify the administrator's password.
This is the password required to login the administration Web interface.

Password: <- 管理者パスワードを入力
Retype password: <- 管理者パスワードの確認でもう一度入力
Administrator's username/password is updated successfully!
https://<サーバーのIPアドレス>:7080/」にアクセスして、変更したユーザー名とパスワードでログインできることを確認します。(認証局から発行されたサーバー証明書ではないので警告が出ます)

LiteSpeed Web Server の管理画面へのログインページ
ログインができたら表示言語を「日本語」に変更しておきます。

表示言語を日本語に変更
Webポート番号の変更(8088 → 80)
初期状態では Webアクセス用ポートに 8088番が使われていますので、これを一般的な 80番に変更します。

リスナーを選択し、リスナー名「Default」をクリックします。

「一般」タブの「編集」ボタンをクリックします。

ポートを「80」に変更して「保存」をクリックします。

LiteSpeed Web Server を再起動して設定を反映します。

http://<サーバーのIPアドレス>/」に接続して、LiteSpeed Web Server のサンプル画面が表示されていればOKです。

PHP7.2 のインストールと切り替え
インストール
WordPress の動作環境として PHP7.2以上が推奨されていますので(2018年6月26日現在)LiteSpeed リポジトリから PHP7.2 をインストールします。

yum -y install lsphp72
yum -y install lsphp72-devel
yum -y install lsphp72-pdo
yum -y install lsphp72-mysqlnd
yum -y install lsphp72-mbstring
yum -y install lsphp72-gd
yum -y install lsphp72-json
yum -y install lsphp72-pear
yum -y install lsphp72-pecl-apcu-devel
yum -y install zlib-devel

yum -y install lsphp81
yum -y install lsphp81-devel
yum -y install lsphp81-pdo
yum -y install lsphp81-mysqlnd
yum -y install lsphp81-mbstring
yum -y install lsphp81-gd
yum -y install lsphp81-json
yum -y install lsphp81-pear
yum -y install lsphp81-pecl-apcu-devel
yum -y install zlib-devel

もしくは

yum -y install lsphp80
yum -y install lsphp80-devel
yum -y install lsphp80-pdo
yum -y install lsphp80-mysqlnd
yum -y install lsphp80-mbstring
yum -y install lsphp80-gd
yum -y install lsphp80-json
yum -y install lsphp80-pear
yum -y install lsphp80-pecl-apcu-devel
yum -y install zlib-devel

切り替え
初期状態では PHP5.6 が使われますので、これをインストールした PHP7.2(lsphp72)に切り替えます。

LiteSpeed Web Serve の管理画面「https://<サーバーのIPアドレス>:7080/」にログインします。

[サーバー設定]→[外部アプリ]タブを選択し、「編集」ボタンをクリックします。

コマンドを「$SERVER_ROOT/lsphp81/bin/lsphp」に変更します。

もしくは、「$SERVER_ROOT/lsphp80/bin/lsphp」

ページ上部の「保存」をクリックします。

LiteSpeed Web Server を再起動して設定を反映します。

http://<サーバーのIPアドレス>/phpinfo.php」に接続して、PHP のバージョンが 7.2.x であることを確認します。 (この手順ではphp8.1)

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?