如何在CentOS 7上安裝OpenLiteSpeed Web服務(wù)器-開源輕量高性能的建站面板

LiteSpeed是一款可以替換Apache的企業(yè)級Web服務(wù)器,具有高性能,低資源占用,安全,易用的特點。它支持直接使用Apache的配置文件,可直接使用.htacess,無需額外配置,兼容Mod_Security。因此避免像Nginx那樣需要自己寫重寫規(guī)則的麻煩。

而OpenLiteSpeed是LiteSpeed的開源免費版本,除了保留了LiteSpeed輕量、高性能的特性外,它還加入了非常多的“前沿”技術(shù),例如HTTP3/QUIC/TLS1.3/Brotli等都是默認就支持的,而且LiteSpeed Cache 高性能緩存功能可以大大提升PHP的執(zhí)行效率。

OpenLiteSpeed提供了一個服務(wù)器控制面板,這個控制面板可以讓實現(xiàn)在線添加虛擬主機、綁定域名、設(shè)置端口號等建站操作,對于想要使用LiteSpeed來建站的朋友是一個非常好的平臺。

OpenLiteSpeed安裝與使用-開源輕量高性能的建站面板-免費SSL,多PHP切換,LiteSpeed Cache

OpenLiteSpeed安裝方法

1.1 安裝OLS

直接根據(jù)你自己的操作系統(tǒng)使用命令安裝即可:

CentOS 5: 
rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el5.noarch.rpm
CentOS 6: 
rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el6.noarch.rpm
CentOS 7: 
rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
CentOS 8: 
rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm
Debian 7, 8 & Ubuntu 12,14,16,18 : 
wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash
For CentOS:
yum install openlitespeed
For Debian & Ubuntu:
apt-get install openlitespeed

1.2 安裝PHP

默認的OpenLiteSpeed是安裝了PHP7.3,執(zhí)行以下命令安裝PHP 7.3:

For CentOS:
yum install epel-release
yum install lsphp73 lsphp73-common lsphp73-mysql lsphp73-gd lsphp73-process lsphp73-mbstring lsphp73-xml lsphp73-mcrypt lsphp73-pdo lsphp73-imap lsphp73-soap lsphp73-bcmath
ln -sf /usr/local/lsws/lsphp73/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
For Debian & Ubuntu:
apt-get install lsphp73
ln -sf /usr/local/lsws/lsphp73/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5

想要安裝多個PHP的,可以使用以下命令安裝(想要哪個版本只要替換一下數(shù)字就行):

apt-get install lsphp74
ln -sf /usr/local/lsws/lsphp74/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
#If you wish to install an older version such as PHP 5.6, replace lsphp73 to lsphp56.

1.3 安裝數(shù)據(jù)庫

執(zhí)行以下命令安裝mariadb數(shù)據(jù)庫。

For CentOS: yum install mariadb-server mariadb-client 
For Debian & Ubuntu: sudo apt-get install mariadb-server mariadb-client

執(zhí)行以下命令對數(shù)據(jù)庫進行安全設(shè)置。

mysql_secure_installation

首先,它會詢問您MariaDB root密碼。由于我們還沒有設(shè)置,只需按ENTER繼續(xù)。下一步要求您設(shè)置root密碼。選擇并確認數(shù)據(jù)庫系統(tǒng)的管理密碼。

對于其余問題,您只需按Enter即可接受默認建議。這將恢復(fù)我們的數(shù)據(jù)庫系統(tǒng)上的一些不安全的設(shè)置。

root@ecs-OA5Ok:~# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): 
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] n
 ... skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
 ... skipping.
By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
 ... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!

重啟或者關(guān)閉數(shù)據(jù)庫。

systemctl start mariadb   啟動MariaDB
systemctl restart mariadb

更改OpenLiteSpeed的默認管理員密碼

首先,我們應(yīng)該更改OpenLiteSpeed的默認管理密碼。默認情況下,它設(shè)置為“123456”,因此我們應(yīng)立即修改此值。

要更改密碼,請執(zhí)行以下腳本:

sudo /usr/local/lsws/admin/misc/admpass.sh

您可以為管理帳戶選擇用戶名,也可以通過按ENTER鍵來接受默認值“admin”。之后,您將必須為管理用戶提供一個密碼并且驗證改密碼。請確保選擇一個安全性高的密碼,因為默認情況下管理登錄屏幕對Web是開放的。

二、OpenLiteSpeed面板使用

2.1 測試默認網(wǎng)頁和管理界面

OpenLiteSpeed服務(wù)器應(yīng)該已經(jīng)啟動并運行。如果需要啟動,停止,重新啟動或檢查服務(wù)器的狀態(tài),請使用帶有l(wèi)sws服務(wù)名稱的標準service命令:

sudo service lsws status

在Web瀏覽器中,您可以查看OpenLiteSpeed的默認網(wǎng)頁。導(dǎo)航到服務(wù)器的域名或IP地址,然后指定:8088端口:

http://server_domain_or_IP:8088

您將看到一個頁面是默認的OpenLiteSpeed網(wǎng)頁,如下所示:

如果不能打開,可能是默認的防火墻開啟沒有例外端口,以centos 7為例,我們來個簡單粗暴的命令就應(yīng)該可以打開網(wǎng)頁了:

systemctl stop firewalld.service

如果單擊鏈接,您應(yīng)該注意到已經(jīng)安裝并正確配置了許多功能。例如,可以使用示例CGI腳本,啟動并運行自定義PHP實例,配置自定義錯誤頁面和身份驗證門。點擊四處探索一下。

如果您對默認站點感到滿意,我們可以繼續(xù)使用管理界面。在Web瀏覽器中,使用HTTPS導(dǎo)航到服務(wù)器的域名或IP地址,然后指定:7080端口:

https://server_domain_or_IP:7080

您可能會看到一個頁面警告您無法驗證來自服務(wù)器的SSL證書。由于這是一個自簽名證書,這是預(yù)期的。點擊可用選項以進入該網(wǎng)站(在Chrome中,您必須單擊“高級”,然后“繼續(xù)…”)。

系統(tǒng)將提示您輸入剛剛使用該admpass.sh腳本選擇的管理名稱和密碼:

正確驗證后,您將看到OpenLiteSpeed管理界面(這個就是OpenLiteSpeed的后臺管理面板,主要有主面板、服務(wù)器、監(jiān)聽器、虛擬主機、虛擬主機模板、工具、管理控制臺設(shè)置等。):

三:PHPMyAdmin安裝管理

OpenLiteSpeed沒有在線的數(shù)據(jù)庫管理PHPMyAdmin,所以管理數(shù)據(jù)庫都比較麻煩,我們可以自己安裝一個。使用以下命令登錄到你的數(shù)據(jù)庫,創(chuàng)建一個數(shù)據(jù)庫名:veidc,密碼為:veidc.com?的數(shù)據(jù)庫。(請?zhí)鎿Q為你自己的)

sudo mysql -u root -p
CREATE DATABASE veidc CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON veidc.* TO veidc@localhost IDENTIFIED BY 'veidc.com';
FLUSH PRIVILEGES;
quit

然后是下載并安裝PHPMyAdmin了,使用以下命令:

cd /usr/local/lsws/Example/html
wget https://files.phpmyadmin.net/phpMyAdmin/4.9.7/phpMyAdmin-4.9.7-all-languages.zip
#apt install unzip 或 yum install unzip
unzip phpMyAdmin-4.9.7-all-languages.zip
mv phpMyAdmin-4.9.7-all-languages phpmyadmin

現(xiàn)在打開地址:http://server_IP:8088/phpmyadmin/index.php,你就可以看到PHPMyAdmin管理界面了。

贊(0)
版權(quán)聲明:本文采用知識共享 署名4.0國際許可協(xié)議 [BY-NC-SA] 進行授權(quán), 轉(zhuǎn)載請注明出處。
文章名稱:《如何在CentOS 7上安裝OpenLiteSpeed Web服務(wù)器-開源輕量高性能的建站面板》
文章鏈接:http://www.lrracing.com/16692.html
【聲明】:國外主機測評僅分享信息,不參與任何交易,也非中介,所有內(nèi)容僅代表個人觀點,均不作直接、間接、法定、約定的保證,讀者購買風(fēng)險自擔。一旦您訪問國外主機測評,即表示您已經(jīng)知曉并接受了此聲明通告。
【關(guān)于安全】:任何 IDC商家都有倒閉和跑路的可能,備份永遠是最佳選擇,服務(wù)器也是機器,不勤備份是對自己極不負責的表現(xiàn),請保持良好的備份習(xí)慣。