LoginSignup
1
0

More than 1 year has passed since last update.

LiteSpeed Web Server を無料で構築する(Oracle Cloud編)

Last updated at Posted at 2021-05-28

はじめに

LiteSpeed には下記の呼び方がありますが、ここでは LiteSpeed もしくは LSWS と表記します。

  • LiteSpeed Web Server (有料ライセンス版を含む正式な呼称)
  • LSWS (上記を略した呼称)
  • OpenLiteSpeed (OSS版のみを指す呼称)

実際にインストールするのは OpenLiteSpeed となります。

環境

  • Oracle Linux 8

LiteSpeed をインストールする

EPELリポジトリを探す
[root@vm opc]# dnf repolist all | grep -i epel
ol8_developer_EPEL               Oracle Linux 8 EPEL Packages for Devel disabled
EPELリポジトリを有効にする
[root@vm opc]# dnf config-manager --enable ol8_developer_EPEL
OpenLitespeedのリポジトリ追加
[root@vm opc]# rpm --import https://rpms.litespeedtech.com/centos/RPM-GPG-KEY-litespeed

https://rpms.litespeedtech.com/centos/ の中から最新のモノを探して URL をコピー

rpmを落としてrpmコマンドで入れる
[root@vm opc]# curl -OL https://rpms.litespeedtech.com/centos/litespeed-repo-1.2-1.el8.noarch.rpm
[root@vm opc]# rpm -ivh --nodeps litespeed-repo-1.2-1.el8.noarch.rpm

注意:CentOS用なのでdnfコマンドではインストールできません。(クリックで詳細を開く)
CentOS用なのでdnfコマンドではインストールできません
[root@vm opc]# dnf -y install https://rpms.litespeedtech.com/centos/litespeed-repo-1.2-1.el8.noarch.rpm
Error: 
 Problem: conflicting requests
  - nothing provides centos-release >= 5 needed by litespeed-repo-1.2-1.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

▲ CentOSに導入する際はこのコマンドで良いです。

アップデートする
[root@vm opc]# dnf update
インストールする
[root@vm opc]# dnf install openlitespeed lsphp80 lsphp80-gd  lsphp80-imap lsphp80-mbstring lsphp80-mysqlnd lsphp80-opcache lsphp80-pdo lsphp80-process lsphp80-xml lsphp80-zip

初期設定

パスワードの設定
[root@vm opc]# /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]: USERNAME 

Password: PASSWORD
Retype password: PASSWORD
Administrator's username/password is updated successfully!

USERNAME と PASSWORD は各自置き換えてください。

設定ファイルをバックアップする
[root@vm opc]# cp /usr/local/lsws/conf/httpd_config.conf /usr/local/lsws/conf/httpd_config.conf.org
PHP8を使えるようにする
[root@vm opc]# vi /usr/local/lsws/conf/httpd_config.conf
/usr/local/lsws/conf/httpd_config.conf
extProcessor lsphp{
    type                            lsapi
    address                         uds://tmp/lshttpd/lsphp.sock
    maxConns                        10
    env                             PHP_LSAPI_CHILDREN=10
    env                             LSAPI_AVOID_FORK=200M
    initTimeout                     60
    retryTimeout                    0
    persistConn                     1
    pcKeepAliveTimeout
    respBuffer                      0
    autoStart                       1
    path                            $SERVER_ROOT/lsphp73/bin/lsphp
    backlog                         100
    instances                       1
    priority                        0
    memSoftLimit                    2047M
    memHardLimit                    2047M
    procSoftLimit                   1400
    procHardLimit                   1500
}

+ extProcessor lsphp80{
+     type                            lsapi
+     address                         uds://tmp/lshttpd/lsphp.sock
+     maxConns                        10
+     env                             PHP_LSAPI_CHILDREN=10
+     env                             LSAPI_AVOID_FORK=200M
+     initTimeout                     60
+     retryTimeout                    0
+     persistConn                     1
+     pcKeepAliveTimeout
+     respBuffer                      0
+     autoStart                       1
+     path                            $SERVER_ROOT/lsphp80/bin/lsphp
+     backlog                         100
+     instances                       1
+     priority                        0
+     memSoftLimit                    2047M
+     memHardLimit                    2047M
+     procSoftLimit                   1400
+     procHardLimit                   1500
+ }

初期設定の行を複製して、PHP8用の外部アプリを定義します。

extProcessor lsphp ▶ extProcessor lsphp80
path $SERVER_ROOT/lsphp73/bin/lsphp ▶ path $SERVER_ROOT/lsphp80/bin/lsphp

変更点は上記2か所です。

ポートを80番に変更します

/usr/local/lsws/conf/httpd_config.conf
listener Default{
-    address                  *:8088
+    address                  *:80
    secure                   0
    map                      Example *
}
自動起動を設定して、今すぐ起動する
[root@vm opc]# systemctl enable --now lsws

Firewall に穴を開ける

管理画面用
[root@vm opc]# firewall-cmd --zone=public --permanent --add-port=7080/tcp
HTTPのポート
[root@vm opc]# firewall-cmd --zone=public --permanent --add-port=80/tcp
HTTPSのポート
[root@vm opc]# firewall-cmd --zone=public --permanent --add-port=443/tcp
再読み込み
[root@vm opc]# firewall-cmd --reload

OCIの仮想ネットワークに穴を開ける

PHP 8 をデフォルトにする

完了です。同じ手順で別のバージョン(PHP 7.4 など)をデフォルトにすることもできます。
またバーチャルホストごとに PHP バージョンを切り替える事もできます。

メモ

インストールディレクトリ
/usr/local/lsws/
設定ファイル
/usr/local/lsws/conf/httpd_config.conf
初期設定のドキュメントルート
/usr/local/lsws/Example/html/

関連リンク

公式マニュアル(英語)

Next

1
0
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
1
0