搬瓦工VPS安装OpenLiteSpeed Web服务器(基于CentOS 7系统)

LiteSpeed是一款可以替换Apache的企业级Web服务器,具有高性能,低资源占用,安全,易用的特点。它支持直接使用Apache的配置文件,可直接使用.htacess,无需额外配置,兼容Mod_Security。因此避免像Nginx那样需要自己写重写规则的麻烦。

而OpenLiteSpeed是LiteSpeed的开源免费版本,除了保留了LiteSpeed轻量、高性能的特性外,它还加入了非常多的“前沿”技术,例如HTTP3/QUIC/TLS1.3/Brotli等都是默认就支持的,而且LiteSpeed Cache 高性能缓存功能可以大大提升PHP的执行效率。

OpenLiteSpeed提供了一个服务器控制面板,这个控制面板可以让实现在线添加虚拟主机、绑定域名、设置端口号等建站操作,对于想要使用LiteSpeed来建站的朋友是一个非常好的平台。

OpenLiteSpeed安装方法
1.1 安装OLS

直接根据你自己的操作系统使用命令安装即可:

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,执行以下命令安装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的,可以使用以下命令安装(想要哪个版本只要替换一下数字就行):

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 安装数据库

执行以下命令安装mariadb数据库。

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

执行以下命令对数据库进行安全设置。

mysql_secure_installation

首先,它会询问您MariaDB root密码。由于我们还没有设置,只需按ENTER继续。下一步要求您设置root密码。选择并确认数据库系统的管理密码。

对于其余问题,您只需按Enter即可接受默认建议。这将恢复我们的数据库系统上的一些不安全的设置。

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!

重启或者关闭数据库。

systemctl start mariadb 启动MariaDB
systemctl restart mariadb

更改OpenLiteSpeed的默认管理员密码

首先,我们应该更改OpenLiteSpeed的默认管理密码。默认情况下,它设置为“123456”,因此我们应立即修改此值。

要更改密码,请执行以下脚本:

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

您可以为管理帐户选择用户名,也可以通过按ENTER键来接受默认值“admin”。之后,您将必须为管理用户提供一个密码并且验证改密码。请确保选择一个安全性高的密码,因为默认情况下管理登录屏幕对Web是开放的。

搬瓦工新手必读教程和推荐套餐

搬瓦工新手选择服务器必备的教程。

1、搬瓦工购买教程:搬瓦工VPS主机购买教程 选择一款合适的外贸主机

2、搬瓦工优惠码:BWH3HYATVBJW

3、搬瓦工套餐推荐:搬瓦工云服务器全部套餐对比列表 可选CN2 GIA和香港机房

4、搬瓦工测试IP:搬瓦工全部数据中心测试IP地址和下载测速文件

5、搬瓦工面板管理:搬瓦工KIWIVM面板的全部功能介绍

搬瓦工VPS的最便宜套餐和最具性价比套餐,简单整理如下:

方案CPU内存硬盘流量带宽机房价格购买
CN2 GT1核1GB20GB1TB1GbpsDC8等$49.99/年购买
香港2核2GB40GB500GB1Gbps香港$89.99/月购买
CN2 GIA2核1GB20GB1TB2.5GbpsDC6等$49.99/季购买
CN2 GIA10核32GB640GB10TB10GbpsDC6等$289.99/月购买
日本2核1GB20GB1TB2.5GbpsDC6等$49.99/季购买

本文结束。

未经允许不得转载:搬瓦工评测网 » 搬瓦工VPS安装OpenLiteSpeed Web服务器(基于CentOS 7系统)