安装apache手册

本文介绍了如何在Linux系统中安装Apache,并将其设置为开机自启。通过修改配置文件,将服务监听端口改为9999,并创建了默认页面'sorry.html',在主页面无法访问时显示维护信息。此外,还详细说明了防火墙规则的调整,以确保端口开放。最后,提供了在遇到问题时临时关闭SELinux的解决方法。
摘要由CSDN通过智能技术生成

安装apache手册

 

yum install httpd-manual

 

将Apache服务添加到 开机自启中

 

systemctl start httpd

 

systemctl enable httpd

 

设置永久允许http

 

firewall-cmd --permanent --add-service=http

 

防火墙重新加载策略

 

firewall-cmd --reload

 

进入默认发布的目录,并编辑默认发布文件内容

 

vim /var/www/html/index.html

 

<h1>hi<h1>

 

将访问端口设为9999

 

进入主配置目录

 

cd /etc/httpd/conf

 

修改主配置文件端口为9999

 

vim httpd.conf

 

重启httpd服务

 

systemctl restart httpd

 

如果不行则将selinux临时关闭

 

setenforce 0

 

防火墙添加9999端口号

 

firewall-cmd --permanent --add-port=9999/tcp

 

重新加载防火墙

 

firewall-cmd --reload

 

 2、添加新的默认页面sorry.html,在默认主页不能访问的情况下显示“很抱歉...该网站正在维护中

 

请您在4月1号之后再访问,感谢您的支持。”

 

1.进入主配置目录

 

cd /etc/httpd/conf

 

编辑主配置文件,将sorry.html设为新的默认页面

 

vim httpd.conf

 

<IfModule dir_module>

 

    DirectoryIndex index.html sorry.html

 

</IfModule>

 

进入默认发布目录添加sorry.html页面

 

cd /var/www/html

 

vim sorry.html

 

<h1>很抱歉...该网站正在维护中……请您在4月1号之后再访问,感谢您的支持。 </h1>

 

重启http服务

 

systemctl restart httpd

 

打命令编辑httpd.conf

 

cd /etc/httpd/conf

 

Vim httpd.conf

 

Cd  /var/www/hrml

 

Vim sorry.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值