如何在Debian 10上安装和配置OpenLiteSpeed Web服务器
如何在Debian 10上安装和配置OpenLiteSpeed Web服务器
OpenLiteSpeed是LiteSpeed Technologies开发的免费开源轻量级HTTP服务器。 OpenLiteSpeed支持许多操作系统,包括Debian,Ubuntu,Mac OS,FreeBSD等等。它提供了一个基于Web的用户界面,用于从Web浏览器管理Web服务器。 OpenLiteSpeed用于轻松创建和管理网站。它是一个功能强大的模块化HTTP服务器,能够处理数十万个并发连接。
在本教程中,我们将向您展示如何在Debian 10服务器上安装OpenLiteSpeed。
要求
- 运行Debian 10的服务器。
- 您的服务器上配置了root密码。
入门
首先,您需要使用最新版本更新软件包。您可以通过运行以下命令来更新它们:
apt-get update -y
apt-get upgrade -y
更新软件包后,重新启动系统以应用配置更改。
接下来,使用以下命令安装所需的依赖项:
apt-get install install build-essential libexpat1-dev libgeoip-dev libpcre3-dev libudns-dev zlib1g-dev libssl-dev libxml2 libxml2-dev rcs libpng-dev libpng-dev openssl autoconf g++ make openssl libssl-dev libcurl4-openssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev libzip-dev
安装完所有必需的依赖项后,即可继续执行下一步。
安装和配置OpenLiteSpeed
默认情况下,Debian 10默认存储库中不提供OpenLiteSpeed。因此,您需要从源代码安装OpenLiteSpeed。
首先,使用以下命令下载最新版本的OpenLiteSpeed:
wget https://openlitespeed.org/packages/openlitespeed-1.5.2.tgz
下载完成后,使用以下命令解压缩下载的文件:
tar -xvzf openlitespeed-1.5.2.tgz
接下来,将目录更改为openlitespeed-1.5.2并使用以下命令安装OpenLiteSpeed:
cd openlitespeed-1.5.2
sh install.sh
安装OpenLiteSpeed后,您需要配置Web界面的管理密码。您可以使用以下命令执行此操作:
/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): admin 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!
接下来,使用以下命令启动OpenLiteSpeed Web服务:
/etc/init.d/lsws start
OpenLiteSpeed现在正在运行并侦听端口8088.打开Web浏览器并键入URL http:// your-server-ip:8088。您将被重定向到以下页面:
安装MariaDB for OpenLiteSpeed
默认情况下,MariaDB在Debian 10默认存储库中可用。您只需运行以下命令即可安装它:
apt-get install mariadb-server mariadb-client -y
安装MariaDB后,启动MariaDB并使用以下命令在系统重新启动后启用它:
systemctl start mariadb
systemctl enable mariadb
接下来,您需要确保安装MariaDB。您可以通过运行以下脚本来保护它:
mysql_secure_installation
此脚本将设置root密码,删除匿名用户,远程禁用root登录和删除测试数据库。
mysql_secure_installation
回答所有问题,如下所示:
Enter current password for root (enter for none): Set root password? (Y/n): N Remove anonymous users? (Y/n): Y Disallow root login remotely? (Y/n): Y Remove test database and access to it? (Y/n): Y Reload privilege tables now? (Y/n): Y
保护MariaDB后,使用以下命令登录MariaDB shell:
mysql -u root
接下来,通过运行以下命令禁用插件身份验证:
MariaDB ((none))>use mysql;
MariaDB ((none))>update user set plugin='' where User='root';
接下来,使用以下命令刷新权限并退出MariaDB shell:
MariaDB ((none))>flush privileges;
MariaDB ((none))>exit;
完成后,您可以继续下一步。
为OpenLiteSpeed安装PHP
默认情况下,OpenLiteSpeed存储库中不提供PHP。因此,您需要从OpenLiteSpeed Web界面编译PHP。
要访问OpenLiteSpeed管理面板,请打开Web浏览器并键入URL http:// your-server-ip:7080。您应该看到以下页面:
现在,提供您之前创建的管理员用户名和密码,然后单击“登录”按钮。您应该在以下页面中看到OpenLiteSpeed仪表板:
现在,单击工具>编译PHP,您应该看到以下页面:
现在,选择要安装的PHP版本,然后单击Next按钮。您应该看到以下页面:
现在,选择构建选项并单击Next按钮开始下载PHP。该过程成功完成后,您应该看到以下页面:
接下来,单击“下一步”按钮。您应该看到以下页面:
现在,从终端登录到您的服务器并运行预生成的脚本,如下所示:
/usr/local/lsws/phpbuild/buildphp_manual_run.sh
该脚本将下载并编译PHP和相关模块到您的系统。
您可以使用以下命令检查安装过程:
tail -f /usr/local/lsws/phpbuild/buildphp_1563016683.8.log
安装成功完成后,您应该看到以下输出:
copy compiled php binary to litespeed directory cd /usr/local/lsws//fcgi-bin ln -sf lsphp-7.3.6 lsphp7 ============================================== Finished building PHP 7.3.6 with LSAPI ============================================== Sat 13 Jul 2019 08:07:36 AM EDT **DONE**
恭喜您已在Debian 10服务器上成功安装并配置OpenLiteSpeed。您现在可以使用OpenLiteSpeed轻松托管您的网站。有关更多信息,您可以访问OpenLiteSpeed Doc上的OpenLiteSpeed官方文档