debian apache
介绍 (Introduction)
The Apache HTTP server is the most widely-used web server in the world. It provides many powerful features including dynamically loadable modules, robust media support, and extensive integration with other popular software.
Apache HTTP服务器是世界上使用最广泛的Web服务器。 它提供了许多强大的功能,包括可动态加载的模块,强大的媒体支持以及与其他流行软件的广泛集成。
In this guide, we’ll explain how to install an Apache web server on your Debian 10 server.
在本指南中,我们将说明如何在Debian 10服务器上安装Apache Web服务器。
先决条件 (Prerequisites)
Before you begin this guide, you should have a regular, non-root user with sudo privileges configured on your server. Additionally, you will need to enable a basic firewall to block non-essential ports. You can learn how to configure a regular user account and set up a firewall for your server by following our initial server setup guide for Debian 10.
在开始本指南之前,您应该在服务器上配置具有sudo特权的常规非root用户。 此外,您将需要启用基本防火墙以阻止非必需端口。 您可以按照我们针对Debian 10的初始服务器设置指南,了解如何配置常规用户帐户并为服务器设置防火墙。
When you have an account available, log in as your non-root user to begin.
如果您有可用的帐户,请以非root用户身份登录以开始。
第1步-安装Apache (Step 1 — Installing Apache)
Apache is available within Debian’s default software repositories, making it possible to install it using conventional package management tools.
Debian的默认软件存储库中提供了Apache,因此可以使用常规的软件包管理工具进行安装。
Let’s begin by updating the local package index to reflect the latest upstream changes:
让我们首先更新本地包索引以反映最新的上游更改:
- sudo apt update sudo apt更新
Then, install the apache2
package:
然后,安装apache2
软件包:
- sudo apt install apache2 须藤apt install apache2
After confirming the installation, apt
will install Apache and all required dependencies.
确认安装后, apt
将安装Apache和所有必需的依赖项。
步骤2 —调整防火墙 (Step 2 — Adjusting the Firewall)
Before testing Apache, it’s necessary to modify the firewall settings to allow outside access to the default web ports. Assuming that you followed the instructions in the prerequisites, you should have a UFW firewall configured to restrict access to your server.
在测试Apache之前,必须修改防火墙设置以允许外部访问默认Web端口。 假设您已按照先决条件中的说明进行操作,则应该配置UFW防火墙以限制对服务器的访问。
During installation, Apache registers itself with UFW to provide a few application profiles that can be used to enable or disable access to Apache through the firewall.
在安装过程中,Apache向UFW注册以提供一些应用程序配置文件,可用于启用或禁用通过防火墙对Apache的访问。
List the ufw
application profiles by typing:
通过键入以下内容列出ufw
应用程序配置文件:
- sudo ufw app list sudo ufw应用程序列表
You will see a list of the application profiles:
您将看到应用程序配置文件的列表:
Output
Available applications:
AIM
Bonjour
CIFS
. . .
WWW
WWW Cache
WWW Full
WWW Secure
. . .
The Apache profiles begin with WWW:
Apache配置文件以WWW开头:
WWW: This profile opens only port 80 (normal, unencrypted web traffic)
WWW :此配置文件仅打开端口80(正常,未加密的网络流量)
WWW Cache: This profile opens only port 8080 (sometimes used for caching and web proxies)
WWW缓存 :此配置文件仅打开端口8080(有时用于缓存和Web代理)
WWW Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)
WWW Full :此配置文件同时打开端口80(正常,未加密的网络流量)和端口443(TLS / SSL加密的流量)
WWW Secure: This profile opens only port 443 (TLS/SSL encrypted traffic)
WWW Secure :此配置文件仅打开端口443(TLS / SSL加密的流量)
It is recommended that you enable the most restrictive profile that will still allow the traffic you’ve configured. Since we haven’t configured SSL for our server yet in this guide, we will only need to allow traffic on port 80:
建议您启用限制性最强的配置文件,该配置文件仍将允许您配置的流量。 由于本指南中尚未为服务器配置SSL,因此我们只需要允许端口80上的流量通过:
- sudo ufw allow 'WWW' s