温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何自定义Apache Web首页内容

发布时间:2022-02-19 10:21:09 来源:亿速云 阅读:176 作者:iii 栏目:开发技术

本文小编为大家详细介绍“如何自定义Apache Web首页内容”,内容详细,步骤清晰,细节处理妥当,希望这篇“如何自定义Apache Web首页内容”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。

如何自定义Apache Web首页内容

1. 安装Apache

[root@localhost ~]# yum install -y httpd

2. 修改/etc/httpd/conf/httpd.conf配置文件

[root@localhost ~]# vim /etc/httpd/conf/httpd.conf在 vim 中,快速定位到 第 95行
命令模式下 输入 :95
修改为以下形式。记得去掉 # 号ServerName 192.168.XX.XX:80

: wq 保存退出

3. 启动web服务

[root@localhost ~]# systemctl start httpd[root@localhost ~]# netstat -ntl #确认80端口已启用Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp6 0 0 :::80 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:25 :::* LISTEN

4. 检查Apache Web服务是否正常

[root@localhost ~]# cd /var/www/html/[root@localhost html]# ls[root@localhost html]# iptables -F[root@localhost html]# ifconfigens32: flags=4163 mtu 1500
inet 192.168.10.11 netmask 255.255.255.0 broadcast 192.168.10.255
inet6 fe80::20c:29ff:feda:182e prefixlen 64 scopeid 0x20 ether 00:0c:29:da:18:2e txqueuelen 1000 (Ethernet)
RX packets 930 bytes 77097 (75.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 575 bytes 77429 (75.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1 (Local Loopback)
RX packets 88 bytes 7484 (7.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 88 bytes 7484 (7.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

在浏览器输入192.168.10.11,出现以下界面,说明Apache Web服务正常。

如何自定义Apache Web首页内容

5. 自定义首页文件

[root@localhost html]# pwd/var/www/html
[root@localhost html]# vim index.html[root@localhost html]# systemctl restart httpd

在浏览器输入192.168.10.11,出现以下界面,说明自定义首页文件生效。

如何自定义Apache Web首页内容

读到这里,这篇“如何自定义Apache Web首页内容”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI