《HCIP-openEuler实验指导手册》1.2Apache主页面配置

一、配置服务器监听IP及端口

  1. 注释主配置文件"监听IP及端口"部分
bash 复制代码
cd /etc/httpd/conf
cp httpd.conf httpd.conf.bak
vim httpd.conf

可以在普通模式下搜索Listen关键字

bash 复制代码
:/Listen

按n键继续向后搜索

  1. 在/etc/httpd/conf.d中新建子配置文件port.conf:
bash 复制代码
touch /etc/httpd/conf.d/port.conf
echo "Listen 81" > /etc/httpd/conf.d/port.conf

bash 复制代码
touch /etc/httpd/conf.d/port.conf
echo "Listen 192.168.209.137:81" > /etc/httpd/conf.d/port.conf
  1. 重启加载httpd的配置文件
bash 复制代码
systemctl reload httpd
  1. 防火墙添加81端口
bash 复制代码
firewall-cmd --zone=public --add-port=81/tcp --permanent
firewall-cmd --reload
  1. curl命令访问81端口
bash 复制代码
curl 127.0.0.1:81

bash 复制代码
curl 192.168.209.137:81 #换成自己的IP

二、配置主页面

  1. 新建index.html测试页面
bash 复制代码
cd /var/www/html
rm -rf index.html
echo "hello,openEuler" > index.html
cat index.html
  1. 访问测试
bash 复制代码
curl 127.0.0.1:81

三、配置主页面存放目录(配置网站根目录)

  1. 更改根目录
bash 复制代码
mkdir /home/source
mv /var/www/html/index.html /home/source/
echo 'DocumentRoot "/home/source"'> /etc/httpd/conf.d/source.conf
  1. 配置目录访问权限
bash 复制代码
vim /etc/httpd/conf.d/source.conf

添加如下内容:

bash 复制代码
<Directory "/home/source">
        AllowOverride None
        #Allow open access:
        Require all granted
</Directory>
bash 复制代码
systemctl reload httpd
curl 127.0.0.1:81
相关推荐
万岳科技系统开发19 小时前
AI赋能互联网医院小程序开启智慧医疗新时代
人工智能·小程序·apache
愤怒的苹果ext2 天前
Apache Superset 使用
apache·doris·bi·superset·ai bi
qq_185198692 天前
骆驼任务Flowable + Apache Camel 集成
spring·apache·flowable
ClickHouseDB2 天前
ClickHouse 十年开源,今非昔比!
clickhouse·开源·apache
代码不会写3 天前
Apache Iceberg:架构原理、读写机制、性能优化与生态
性能优化·架构·apache·iceberg
Gent_倪4 天前
数据治理之安全管理:Apache Ranger
apache
SelectDB4 天前
Apache Doris 实战教程:手把手实现 ClickHouse 表结构迁移与数据校验
apache
SelectDB4 天前
Apache Doris 实战教程:从零搭建 MCP Server,让 AI Agent 直接用自然语言查数据
apache
SelectDB4 天前
Apache Doris Segment V3 宽表优化实战教程:从建表到体验元数据按需加载
apache
java_logo5 天前
Docker Compose 部署 Apache Superset:轻松搭建开源 BI 平台
docker·开源·apache·superset·轩辕镜像·superset部署方案·docker superset