# 安装 Apache HTTP 服务器
sudo apt update
sudo apt install apache2
# 启动 Apache 服务
sudo systemctl start apache2
# 设置 Apache 开机自启动
sudo systemctl enable apache2
# 检查 Apache 服务状态
sudo systemctl status apache2
# 配置防火墙,允许 HTTP 和 HTTPS 流量
sudo ufw allow in "Apache Full"
# 创建一个简单的 HTML 文件作为测试页面
echo "<html>
<head>
<title>Test Page</title>
</head>
<body>
<h1>Welcome to My Web Server</h1>
</body>
</html>" > /var/www/html/index.html
# 重启 Apache 服务以应用更改
sudo systemctl restart apache2
apt
包管理器安装 Apache。systemctl
命令启动 Apache 服务。上一篇:如何查看linux系统日志
下一篇:linux系统克隆到另一个硬盘
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站