如何在Ubuntu 18.04上安装OpenLiteSpeed Web服务器

news/2024/7/6 6:17:39

介绍 (Introduction)

OpenLiteSpeed is an optimized open source web server that can be used to manage and serve sites. OpenLiteSpeed has some useful features that make it a solid choice for many installations: it features Apache-compatible rewrite rules, a built-in web-based administration interface, and customized PHP processing optimized for the server.

OpenLiteSpeed是经过优化的开源Web服务器,可用于管理和服务站点。 OpenLiteSpeed具有一些有用的功能,使其成为许多安装的可靠选择:它具有与Apache兼容的重写规则,内置的基于Web的管理界面以及针对服务器进行了优化的自定义PHP处理。

In this guide, we’ll demonstrate how to install and configure OpenLiteSpeed on an Ubuntu 18.04 server.

在本指南中,我们将演示如何在Ubuntu 18.04服务器上安装和配置OpenLiteSpeed。

先决条件 (Prerequisites)

To complete this tutorial you will need an Ubuntu 18.04 server with a sudo-enabled, non-root user and the ufw firewall enabled.

要完成本教程,您将需要一台Ubuntu 18.04服务器,该服务器具有启用了sudoroot用户并启用了ufw防火墙。

Please refer to our Initial Server Setup with Ubuntu 18.04 tutorial for instructions on fulfilling these requirements.

请参阅我们的Ubuntu 18.04初始服务器设置教程,以获取有关满足这些要求的说明。

第1步-安装OpenLiteSpeed (Step 1 – Installing OpenLiteSpeed)

OpenLiteSpeed provides a software repository we can use to download and install the server with Ubuntu’s standard apt command.

OpenLiteSpeed提供了一个软件存储库,可用于通过Ubuntu的标准apt命令下载和安装服务器。

To enable this repository for your Ubuntu system, first download and add the developer’s software signing key:

要为您的Ubuntu系统启用此存储库,请首先下载并添加开发人员的软件签名密钥:

  • wget -qO - https://rpms.litespeedtech.com/debian/lst_repo.gpg | sudo apt-key add -

    wget -qO-https://rpms.litespeedtech.com/debian/lst_repo.gpg | sudo apt键添加-

This key is used to cryptographically verify that nobody has tampered with the software we’re about to download.

该密钥用于加密验证没有人篡改我们将要下载的软件。

Next, we add the repository information to our system:

接下来,我们将存储库信息添加到我们的系统中:

  • sudo add-apt-repository 'deb http://rpms.litespeedtech.com/debian/ bionic main'

    sudo add-apt-repository'deb http://rpms.litespeedtech.com/debian/bionic main'

After the repository has been added, the add-apt-repository command will refresh our package cache and the new software will be available to install.

添加存储库后, add-apt-repository命令将刷新我们的程序包缓存,并且可以安装新软件。

Install the OpenLiteSpeed server and its PHP processor using apt install:

使用apt install OpenLiteSpeed服务器及其PHP处理器:

  • sudo apt install openlitespeed lsphp73

    须藤apt install openlitespeed lsphp73

Finally, create a soft link to the PHP processor we just installed. This directs the OpenLiteSpeed server to use the correct version:

最后,创建一个指向刚刚安装PHP处理器的软链接。 这指示OpenLiteSpeed服务器使用正确的版本:

  • sudo ln -sf /usr/local/lsws/lsphp73/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5

    须藤ln -sf / usr / local / lsws / lsphp73 / bin / lsphp / usr / local / lsws / fcgi-bin / lsphp5

Now that the OpenLiteSpeed server is installed, we’ll secure it by updating the default admin account.

现在已经安装了OpenLiteSpeed服务器,我们将通过更新默认的管理员帐户来保护它。

第2步–设置管理密码 (Step 2 – Setting the Administrative Password)

Before we test the server, we should set a new administrative password for OpenLiteSpeed. By default, the password is set to 123456, so we should change this immediately. We can do this by running a script provided by OpenLiteSpeed:

在测试服务器之前,我们应该为OpenLiteSpeed设置一个新的管理密码。 默认情况下,密码设置为123456 ,因此我们应该立即更改它。 我们可以通过运行OpenLiteSpeed提供的脚本来做到这一点:

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

    须藤/usr/local/lsws/admin/misc/admpass.sh

You will be asked to provide a username for the administrative user. If you press ENTER without choosing a new username, the default of admin will be used. Then, you will be prompted to create and confirm a new password for the account. Do so, then hit ENTER one last time. The script will confirm a successful update:

系统将要求您提供管理用户的用户名。 如果按ENTER而不选择新的用户名,则将使用默认的admin 。 然后,将提示您创建并确认该帐户的新密码。 这样做,然后最后一次按ENTER 。 该脚本将确认更新成功:


   
Output
Administrator's username/password is updated successfully!

Now that we’ve secured the admin account, let’s test out the server and make sure it’s running properly.

现在,我们已经保护了管理员帐户的安全,让我们测试一下服务器并确保其正常运行。

步骤3 –启动并连接到服务器 (Step 3 – Starting and Connecting to the Server)

OpenLiteSpeed should have started automatically after it was installed. We can verify this using the lswsctrl command:

安装后,OpenLiteSpeed应该会自动启动。 我们可以使用lswsctrl命令验证这一点:

  • sudo /usr/local/lsws/bin/lswsctrl status

    sudo / usr / local / lsws / bin / lswsctrl状态

   
Output
litespeed is running with PID 990.

If you don’t see a similar message, you can start the server using lswsctrl:

如果没有看到类似的消息,则可以使用lswsctrl启动服务器:

  • sudo /usr/local/lsws/bin/lswsctrl start

    须藤/ usr / local / lsws / bin / lswsctrl start

   
Output
[OK] litespeed: pid=5137.

The server should now be running. Before we can visit it in our browser, we need to open up some ports on our firewall. We’ll do this with the ufw command:

服务器现在应该正在运行。 在浏览器中访问它之前,我们需要打开防火墙上的一些端口。 我们将使用ufw命令执行此操作:

  • sudo ufw allow 8088

    sudo ufw允许8088
  • sudo ufw allow 7080

    须藤ufw允许7080

The first port, 8088, is the default port for OpenLiteSpeed’s example site. It should now be accessible to the public. In your web browser, navigate to your server’s domain name or IP address, followed by :8088 to specify the port:

第一个端口8088是OpenLiteSpeed的示例站点的默认端口。 现在,它应该可供公众使用。 在Web浏览器中,导航到服务器的域名或IP地址,然后导航到:8088以指定端口:

http://server_domain_or_IP:8088

Your browser should load the default OpenLiteSpeed web page, which looks like this:

您的浏览器应加载默认的OpenLiteSpeed网页,如下所示:

The links towards the bottom of the page are designed to demonstrate various features of the server. If you click through them you will notice that these features are already installed and properly configured. For instance, an example CGI script is available, a customized PHP instance is up and running, and custom error pages and authentication gates are configured. Click around to explore a little.

页面底部的链接旨在演示服务器的各种功能。 如果单击它们,您将注意到这些功能已经安装并正确配置。 例如,有一个示例CGI脚本可用,一个自定义PHP实例已启动并正在运行,并且已配置了自定义错误页面和身份验证门。 单击周围进行探索。

When you are satisfied with the default site, you can move on to the administrative interface. In your web browser, using HTTPS, navigate to your server’s domain name or IP address followed by :7080 to specify the port:

当您对默认站点感到满意时,可以转到管理界面。 在Web浏览器中,使用HTTPS,导航到服务器的域名或IP地址,后跟:7080以指定端口:

https://server_domain_or_IP:7080

You will likely see a page warning you that the SSL certificate from the server cannot be validated. Since this is a self-signed certificate, this is expected. Click through the available options to proceed to the site. In Chrome, you must click “Advanced” and then “Proceed to…”.

您可能会看到一个页面,警告您无法验证来自服务器的SSL证书。 由于这是一个自签名证书,因此可以预期。 单击可用选项以转到站点。 在Chrome中,您必须单击“高级”,然后单击“继续...”。

You will be prompted to enter the administrative username and password that you selected with the admpass.sh script in the previous step:

系统将提示您输入在上一步中使用admpass.sh脚本选择的管理用户名和密码:

Once you correctly authenticate, you will be presented with the OpenLiteSpeed administration interface:

正确验证身份后,将显示OpenLiteSpeed管理界面:

This is where the majority of your configuration for the web server will take place.

这是Web服务器大多数配置的地方。

Next, we’ll explore this interface by walking through a common configuration task: updating the port used by the default page.

接下来,我们将通过完成一个常见的配置任务来探索此界面:更新默认页面使用的端口。

步骤4 –更改默认页面的端口 (Step 4 – Changing the Port for the Default Page)

To demonstrate how to configure options through the web interface, we will change the port that the default site uses from 8088 to the conventional HTTP port 80.

为了演示如何通过Web界面配置选项,我们将默认站点使用的端口从8088更改为常规HTTP端口80

To accomplish this, first click Listeners in the list of options on the left side of the interface. A list of all available listeners will load.

为此,请首先在界面左侧的选项列表中单击“ 侦听器” 。 将加载所有可用侦听器的列表。

In the list of listeners, click the “View/Edit” button for the Default listener:

在侦听器列表中,单击默认侦听器的“查看/编辑”按钮:

This will load a page with more details about the Default listener. Click the edit button in the top-right corner of the “Address Settings” table to modify its values:

这将加载一个页面,其中包含有关默认侦听器的更多详细信息。 单击“地址设置”表右上角的编辑按钮,以修改其值:

On the next screen, change port 8088 to port 80, then click the floppy disk icon, Save:

在下一个屏幕上,将端口8088更改为端口80 ,然后单击软盘图标Save

After the modification, you will need to restart the server. Click the “reload” arrow icon to restart OpenLiteSpeed:

修改后,您将需要重新启动服务器。 单击“重新加载”箭头图标以重新启动OpenLiteSpeed:

Additionally, you’ll need to now open up port 80 on your firewall:

此外,您现在需要在防火墙上打开端口80

  • sudo ufw allow 80

    sudo ufw允许80

The default web page should now be accessible in your browser on port 80 instead of port 8088. Visiting your server’s domain name or IP address without providing any port number will now display the site.

现在可以在浏览器中的端口80而不是端口8088上访问默认网页。 现在,在不提供任何端口号的情况下访问服务器的域名或IP地址将显示该站点。

结论 (Conclusion)

OpenLiteSpeed is a fully-featured web server that is primarily managed through the administrative web interface. A full run through of how to configure your site through this interface is outside of the scope of this guide.

OpenLiteSpeed是功能齐全的Web服务器,主要通过管理Web界面进行管理。 如何通过此界面配置站点的完整介绍不在本指南的范围之内。

However, to get you started, we’ll touch on a few important points below:

但是,为了让您入门,我们将在下面重点介绍以下几点:

  • Everything associated with OpenLiteSpeed will be found under the /usr/local/lsws directory.

    与OpenLiteSpeed相关的所有内容都可以在/usr/local/lsws目录下找到。

  • The document root (where your files will be served from) for the default virtual host is located at /usr/local/lsws/DEFAULT/html. The configuration and logs for this virtual host can be found under the /usr/local/lsws/DEFAULT directory.

    默认虚拟主机的文档根目录(将在其中提供文件)位于/usr/local/lsws/DEFAULT/html 。 可在/usr/local/lsws/DEFAULT目录下找到此虚拟主机的配置和日志。

  • You can create new virtual hosts for different sites using the admin interface. However, all of the directories that you will reference when setting up your configuration must be created ahead of time on your server. OpenLiteSpeed is not able to create the directories

    您可以使用管理界面为不同的站点创建新的虚拟主机。 但是, 必须在服务器上提前创建设置配置时将引用的所有目录。 OpenLiteSpeed无法创建目录

  • You can set up virtual host templates for virtual hosts that share the same general format.

    您可以为共享相同常规格式的虚拟主机设置虚拟主机模板。
  • Often, it is easiest to copy the default virtual host’s directory structure and configuration to use as a starting point for new configurations.

    通常,最简单的方法是复制默认虚拟主机的目录结构和配置,以用作新配置的起点。
  • The admin interface has a built-in tooltip help system for almost all fields. There is also a Help menu option in the left-hand menu that links to the server documentation. Consult these sources of information during configuration if you need more help.

    管理界面为几乎所有字段提供了内置的工具提示帮助系统。 左侧菜单中还有一个“ 帮助”菜单选项,可链接到服务器文档。 如果需要更多帮助,请在配置期间查阅这些信息源。

  • To secure your OpenLiteSpeed installation with HTTPS, see the officall documentation’s section on SSL Setup

    要使用HTTPS保护您的OpenLiteSpeed安装,请参阅SSL设置中正式文件的部分

At this point, you should have OpenLiteSpeed and PHP installed and running on an Ubuntu 18.04 server. OpenLiteSpeed offers great performance, a web-based configuration interface, and pre-configured options for script handling.

此时,您应该已经在Ubuntu 18.04服务器上安装并运行了OpenLiteSpeed和PHP。 OpenLiteSpeed具有出色的性能,基于Web的配置界面以及用于脚本处理的预配置选项。

翻译自: https://www.digitalocean.com/community/tutorials/how-to-install-the-openlitespeed-web-server-on-ubuntu-18-04


http://www.niftyadmin.cn/n/3649458.html

相关文章

问答机器人

项目说明&#xff1a;这是一个简单的问答机器人项目&#xff0c;利用不是图灵机器人api&#xff0c;是聚合数据上面的API 首先activity_main布局&#xff1a; <?xml version"1.0" encoding"utf-8"?> <LinearLayout xmlns:android"http://…

后端接口测试工具推荐——Postman

用户在开发或者调试网络程序或者是网页B/S模式的程序的时候是需要一些方法来跟踪网页请求的&#xff0c;用户可以使用一些网络的监视工具比如著名的Firebug等网页调试工具。今天给大家介绍的这款网页调试工具不仅可以调试简单的css、html、脚本等简单的网页基本信息&#xff0c…

[sip]SIP多方会话消息之实例讲解 幻灯片

这是我编写的第6个针对SIP的幻灯片&#xff0c;实例讲述邀请多个好友聊天的SIP消息&#xff0c;可用于Team内讲解并演示SIP协议的讲座。本讲义的版权归郑昀所有。允许拷贝、分发和在“GNU Free Documentation License”下的定制。对于关注SIP应用的你&#xff0c;任何的建议和修…

自己搭建Android项目框架必备的框架与第三方应用

闲来无事、想搭个框架试试 分析一般应用 将资料整理整理 粗略统计 需要以下资料 1、android-pulltorefresh 一个强大的拉动刷新开源项目&#xff0c;支持各种控件下拉刷新 ListView、ViewPager、WevView、ExpandableListView、GridView、(Horizontal )ScrollView、Fragment上下…

mongodb 字段检索_如何在MongoDB中创建,检索,更新和删除记录

mongodb 字段检索介绍 (Introduction) MongoDB is a free and open-source NoSQL document database used commonly in modern web applications. In this short tutorial you’ll explore how to work with data in MongoDB. You’ll create, retrieve, update, and delete re…

Java 集成开发环境——Eclipse JEE的安装和配置Tomcat

Eclipse是一个开放源代码的、基于Java的可扩展开发平台。就其本身而言&#xff0c;它只是一个框架和一组服务&#xff0c;用于通过插件组件构建开发环境。幸运的是&#xff0c;Eclipse 附带了一个标准的插件集&#xff0c;包括Java开发工具(Java Development Kit&#xff0c;JD…

Android Binder机制(超级详尽)

1&#xff0e;binder通信概述 binder通信是一种client-server的通信结构&#xff0c; 1.从表面上来看&#xff0c;是client通过获得一个server的代理接口&#xff0c;对server进行直接调用&#xff1b; 2.实际上&#xff0c;代理接口中定义的方法与server中定义的…

instagram架构_使用Facebook,Instagram和LinkedIn进行Django身份验证

instagram架构介绍 (Introduction) Manually signing up for and signing into accounts online can sometimes prove onerous. Modern web applications solve this through social authentication, which is primarily a way to allow users to sign in (and sign-up) with t…