当前位置: 首页 > news >正文

Linux CentOS 7 安装Apache 部署html页面

*、使用yum包管理器安装Apache。运行以下命令:

sudo yum install httpd

*、启动Apache服务

sudo systemctl start httpd

*、设置Apache服务开机自启

sudo systemctl enable httpd

*、验证Apache是否运行

sudo systemctl status httpd

或者,通过浏览器访问服务器的IP地址或域名来查看默认的Apache页面。如果你不确定服务器的IP地址,可以使用以下命令查找:

ip addr show eth0 | grep inet | awk '{ print $2; }'  # 假设你的网络接口是eth0,根据实际情况修改

http://127.0.0.1:80
http://localhost:80
*
https://127.0.0.1:443
https://localhost:443
*
*、重启Apache服务

sudo systemctl restart httpd

*、创建HTML文件目录,例如/var/www/html

sudo mkdir -p /var/www/html

*、创建文件

# 跳转到目录
cd /var/www/html# 查看路径
pwd# 新建文件
touch a.txt# 编辑文件
vim a.html

*、运行页面
打开浏览器,地址栏输入:http://localhost/a.html

*、停止Apache服务

sudo systemctl stop httpd

*、禁用Apache服务,系统启动时不会自动启动Apache

sudo systemctl disable httpd

*、卸载Apache包及其依赖的包

sudo yum remove httpd httpd-tools mod_ssl

*
*
*


http://www.mrgr.cn/news/100689.html

相关文章:

  • [stm32] 4-1 USART(1)
  • 使用C# ASP.NET创建一个可以由服务端推送信息至客户端的WEB应用(1)
  • 【Prometheus-Postgres Exporter安装配置指南,开机自启】
  • Shopify网上商店GraphQL Admin接口查询实战
  • IAP远程升级入门讲解
  • 对 FormCalc 语言支持较好的 PDF 编辑软件综述
  • 十五种光电器件综合对比——《器件手册--光电器件》
  • Linux环境变量以及进程虚拟地址原理
  • WPF之Button控件详解
  • Vue 中的过渡效果与响应式数据:transition、transitiongroup、reactive 和 ref 详解
  • 【Prometheus-Mongodb Exporter安装配置指南,开机自启】
  • 2025运维工程师面试题1(答案在后一张)
  • CSS:编写位置分类及优先级
  • Git常用指令速查
  • 论文阅读:2024 ACL ArtPrompt: ASCII Art-based Jailbreak Attacks against Aligned LLMs
  • go单向链表
  • 【LeetCode】螺旋矩阵
  • TwinCAT3安装记录
  • 在VTK中使用巴特沃斯低通滤波器(频域处理)
  • 探索目标检测:边界框与锚框的奥秘