debian 10A安装apache

借鉴:
https://www.howtoing.com/how-to-install-the-apache-web-server-on-debian-10
第1步 - 安装Apache

sudo apt update
sudo apt install apache2

第2步 - 调整防火墙

sudo ufw app list
应该看到
...
 WWW
 WWW Cache
 WWW Full
 WWW Secure
...

我遇到:

sudo: ufw: command not found

ufw没有安装
关于ufw:
iptables可以灵活的定义防火墙规则, 功能非常强大。但是由此产生的副作用便是配置过于复杂。一向以简单易用著称Ubuntu在它的发行版中,附带了一个相对iptables简单很多的防火墙配置工具:ufw。

安装UFW:

sudo apt-get install ufw
开启/关闭防火墙 (默认设置是’disable’)
#ufw enable|disable

继续:

sudo ufw enable              //这句没有是inactive
sudo ufw allow 'WWW'
sudo ufw status

应该在显示的输出中看到允许的HTTP流量:

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
WWW                        ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
WWW (v6)                   ALLOW       Anywhere (v6)

第3步 - 检查Web服务器

sudo systemctl status apache2

应该是running

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2020-08-23 19:51:23 CST; 13s ago
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 7977 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 7988 (apache2)
    Tasks: 7 (limit: 2279)
   Memory: 24.7M
   CGroup: /system.slice/apache2.service
           ├─7988 /usr/sbin/apache2 -k start
           ├─7989 /usr/sbin/apache2 -k start
           ├─7990 /usr/sbin/apache2 -k start
           ├─7991 /usr/sbin/apache2 -k start
           ├─7992 /usr/sbin/apache2 -k start
           ├─7993 /usr/sbin/apache2 -k start
           └─7994 /usr/sbin/apache2 -k start

Aug 23 19:51:22 Debian systemd[1]: Starting The Apache HTTP Server...
Aug 23 19:51:23 Debian apachectl[7977]: AH00558: apache2: Could not reliably determine the server's fu
Aug 23 19:51:23 Debian systemd[1]: Started The Apache HTTP Server.

出错:

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: https://httpd.apache.org/docs/2.4/

解决:

sudo apt-get update
sudo apt-get install -y apache2
sudo service apache2 start
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值