《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
相关推荐
忙碌的菠萝5 分钟前
使用Apache Lucene构建高效的全文搜索服务
apache·mybatis·lucene
人类群星闪耀时4 小时前
Apache Flink:实时数据流处理的终极武器
struts·flink·apache
spencer_tseng19 小时前
apache-maven-3.2.1
java·maven·apache
码农老起21 小时前
Java HTTP 请求的四种实现方式:Apache HttpClient、OkHttp、WebClient 与 Java 11 HttpClient
java·http·apache
Faith_xzc2 天前
Apache Doris 索引的全面剖析与使用指南
大数据·数据仓库·apache·数据库开发·doris
鹏说大数据2 天前
Apache DolphinScheduler系列1-单节点部署及测试报告
apache
ITPUB-微风2 天前
Apache IoTDB: 物联网时序数据库的分布式核心技术与实际应用
物联网·apache·iotdb
張萠飛2 天前
如何成为Apache Doris的贡献者
大数据·apache·doris
计算机毕设指导63 天前
基于Springboot医院预约挂号小程序系统【附源码】
java·spring boot·后端·spring·小程序·apache·intellij-idea