如何在CentOS 8中安裝OpenLiteSpeed Web服務器

導讀 OpenLiteSpeed是LiteSpeed的開源版本,是一個強大的、輕量級開源HTTP web服務器,由LightSpeed技術在GPLv3.0許可下開發。

系統環境

CentOS 8

配置OpenLiteSpeed軟件源

首先將OpenLiteSpeed軟件源添加到CentOS 8:

[root@localhost ~]# rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm

如何在CentOS 8中安裝OpenLiteSpeed Web服務器如何在CentOS 8中安裝OpenLiteSpeed Web服務器
更新軟件源:

[root@localhost ~]# dnf makecache

從OpenLiteSpeed軟件源安裝PHP

在這一步中,我們將使用俗稱LSPHP的OpenLiteSpeed軟件源安裝PHP 7.4。但是在此之前,請確保使用以下命令添加了epel軟件源:

[root@localhost ~]# dnf install -y epel-release

安裝epel軟件源後,下面安裝LSPHP:

[root@localhost ~]# dnf install -y lsphp74 lsphp74-mysqlnd lsphp74-process lsphp74-mbstring lsphp74-mcrypt lsphp74-gd lsphp74-opcache lsphp74-bcmath lsphp74-pdo lsphp74-common lsphp74-xml

如何在CentOS 8中安裝OpenLiteSpeed Web服務器如何在CentOS 8中安裝OpenLiteSpeed Web服務器
使用上述dnf命令成功安裝PHP軟件包後,接下來我們安裝MariaDB數據庫服務器。

安裝MariaDB數據庫

運行下面命令安裝mariadb-server:

[root@localhost ~]# dnf install -y mariadb mariadb-server

安裝完成之後,啓用mariadb服務的開機啓動,並啓動服務:

[root@localhost ~]# systemctl enable mariadb
[root@localhost ~]# systemctl start mariadb

運行以下systemctl命令以檢查mariadb服務的狀態,

[root@localhost ~]# systemctl status mariadb

如何在CentOS 8中安裝OpenLiteSpeed Web服務器如何在CentOS 8中安裝OpenLiteSpeed Web服務器
默認情況下,MariaDB並不安全,因此,我們需要採取一些額外的步驟來保護MariaDB。運行以下步驟:

[root@localhost ~]# mysql_secure_installation 

首先需要爲root用戶設置密碼
如何在CentOS 8中安裝OpenLiteSpeed Web服務器如何在CentOS 8中安裝OpenLiteSpeed Web服務器
對於其他的提示。只需輸入“Y”以執行最佳實踐設置:
如何在CentOS 8中安裝OpenLiteSpeed Web服務器如何在CentOS 8中安裝OpenLiteSpeed Web服務器


安裝OpenLiteSpeed

使用dnf包管理器來安裝OpenLiteSpeed:

[root@localhost ~]# dnf install -y openlitespeed

查看以下web服務是否啓動,一般情況夏安裝完成自動啓動:

[root@localhost ~]# systemctl status lsws

如何在CentOS 8中安裝OpenLiteSpeed Web服務器如何在CentOS 8中安裝OpenLiteSpeed Web服務器
Web服務偵聽兩個端口:8088和7080。端口8088用於演示,而端口7080是管理頁面。

可以使用netstat命令確認Web服務器正在偵聽的端口,如下所示:

[root@localhost ~]# netstat -tlunp

如何在CentOS 8中安裝OpenLiteSpeed Web服務器如何在CentOS 8中安裝OpenLiteSpeed Web服務器
如果防火牆正在運行,需要打開下面的端口:

[root@localhost ~]# firewall-cmd --permanent --add-port=8088/tcp
success
[root@localhost ~]# firewall-cmd --permanent --add-port=7080/tcp
success
[root@localhost ~]# firewall-cmd --reload
success

如何在CentOS 8中安裝OpenLiteSpeed Web服務器如何在CentOS 8中安裝OpenLiteSpeed Web服務器

更改默認管理密碼

默認情況下,管理員的密碼設置爲123456,我們需要更改此密碼爲一個非常可靠的密碼。更好的是,可以設置一個其他用戶爲管理用戶,運行下面的腳本來修改管理員配置:

[root@localhost ~]# /usr/local/lsws/admin/misc/admpass.sh 

如何在CentOS 8中安裝OpenLiteSpeed Web服務器如何在CentOS 8中安裝OpenLiteSpeed Web服務器

訪問OpenLiteSpeed的web頁面

如果要訪問OpeLiteSpeed Web服務器的默認頁面,輸入服務器的ip地址+8088端口。
如何在CentOS 8中安裝OpenLiteSpeed Web服務器如何在CentOS 8中安裝OpenLiteSpeed Web服務器
如果要訪問管理頁面,輸入服務器的ip地址+7080端口。賬號密碼爲上一步設置的管理員
如何在CentOS 8中安裝OpenLiteSpeed Web服務器如何在CentOS 8中安裝OpenLiteSpeed Web服務器


如何在CentOS 8中安裝OpenLiteSpeed Web服務器如何在CentOS 8中安裝OpenLiteSpeed Web服務器
到此就安裝結束啦!

總結

OpenLiteSpeed是LiteSpeed的開源版本,是一個強大的、輕量級開源HTTP web服務器,由LightSpeed技術在GPLv3.0許可下開發。

本文原創地址:https://www.linuxprobe.com/centos8-install-olws.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章