Apache的管理及Web页面的优化

实验环境
(1)设置IP
(2)配置软件仓库


1.Apache和web

什么是Web?
web(World Wide Web) 即全球广域网,也称为万维网,
即通过超文本传输协议把服务器上前端开发人员所写好的网页发布,客户端可以通过浏览器进行访问网页,建立在Internet上的一种网络服务。
什么是apache?
(音译为阿帕奇)
在web页面被访问时通常使用http://的方式
Apache作为一种由超文本传输协议提供的软件在web服务器上运行;
http:// 超文本传输协议提供的软件:
Aache
nginx
stgw
jfe
Tengine


2.Apache的基本信息

服务名称:httpd
配置文件:
/etc/httpd/conf/httpd.conf    主配置文件
/etc/httpd/conf.d/*.conf      子配置文件
默认发布目录:
/var/www/html
默认发布文件:
index.html
默认端口:
http    #80
https   #443

用户:apache
日志:/etc/httpd/logs

3.Apache的安装

dnf search apache             查看apache配置文件
dnf install httpd.x86_64 -y   安装apache

4.Apache的启用

systemctl enable --now httpd
firewalld-cmd --list-all
firewalld-cmd --permanent --add-service=http
firewalld-cmd --permanent --add-service=https
firewalld-cmd --reload

在这里插入图片描述

测试:
cd /var/www/html
vim index.html
写入 hello linuxrui

在这里插入图片描述

"编辑完成之后在虚拟机或Windows浏览器输入IP192.168.165.55即可访问自己编辑的内容“
在这里插入图片描述


5.Apache的基本配置

(1)Apache的端口修改

vim /etc/httpd/conf/httpd.conf
listen 8080
firewalld-cmd --permanent --add-port=8080/tcp
firewalld-cmd --reload
systemctl restart httpd

在这里插入图片描述
在这里插入图片描述

测试:http://192.168.165.55

在这里插入图片描述

(2)修改默认发布文件优先级

vim /etc/httpd/conf/httpd.conf
DirectoryIndex westos.html index.html
systemctl restart httpd

在这里插入图片描述在这里插入图片描述

在这里插入图片描述

测试:http://192.168.165.55

在这里插入图片描述

(3)修改默认发布目录优先级

mkdir /linu
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值