《Linux系列》开发HTML静态页面并配置到服务器

HTML静态页面配置到服务器

心血来潮,想要把HTML页面以最简单的方式布置到服务器上

一、首先安装httpd

[root@hadoop_zxy ~]# yum install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-97.el7.centos.2 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-97.el7.centos.2 for package: httpd-2.4.6-97.el7.centos.2.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-97.el7.centos.2.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-97.el7.centos.2 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================
 Package                        Arch                      Version                                   Repository                  Size
=====================================================================================================================================
Installing:
 httpd                          x86_64                    2.4.6-97.el7.centos.2                     updates                    2.7 M
Installing for dependencies:
 httpd-tools                    x86_64                    2.4.6-97.el7.centos.2                     updates                     94 k
 mailcap                        noarch                    2.1.41-2.el7                              os                          31 k

Transaction Summary
=====================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 2.8 M
Installed size: 9.6 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): mailcap-2.1.41-2.el7.noarch.rpm                                                                        |  31 kB  00:00:00
(2/3): httpd-tools-2.4.6-97.el7.centos.2.x86_64.rpm                                                           |  94 kB  00:00:00
(3/3): httpd-2.4.6-97.el7.centos.2.x86_64.rpm                                                                 | 2.7 MB  00:00:00
-------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                4.8 MB/s | 2.8 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : httpd-tools-2.4.6-97.el7.centos.2.x86_64                                                                          1/3
  Installing : mailcap-2.1.41-2.el7.noarch                                                                                       2/3
  Installing : httpd-2.4.6-97.el7.centos.2.x86_64                                                                                3/3
  Verifying  : httpd-2.4.6-97.el7.centos.2.x86_64                                                                                1/3
  Verifying  : mailcap-2.1.41-2.el7.noarch                                                                                       2/3
  Verifying  : httpd-tools-2.4.6-97.el7.centos.2.x86_64                                                                          3/3

Installed:
  httpd.x86_64 0:2.4.6-97.el7.centos.2

Dependency Installed:
  httpd-tools.x86_64 0:2.4.6-97.el7.centos.2                              mailcap.noarch 0:2.1.41-2.el7

Complete!

二、启动Httpd

[root@hadoop_zxy ~]# systemctl enable httpd.service #开机自启
[root@hadoop_zxy ~]# systemctl is-enabled httpd.service
abled
[root@hadoop_zxy ~]# systemctl start httpd.service
[root@hadoop_zxy ~]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-12-28 12:38:24 CST; 25s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 14017 (httpd)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service
           ├─14017 /usr/sbin/httpd -DFOREGROUND
           ├─14018 /usr/sbin/httpd -DFOREGROUND
           ├─14019 /usr/sbin/httpd -DFOREGROUND
           ├─14020 /usr/sbin/httpd -DFOREGROUND
           ├─14021 /usr/sbin/httpd -DFOREGROUND
           └─14022 /usr/sbin/httpd -DFOREGROUND

Dec 28 12:38:24 hadoop_zxy systemd[1]: Starting The Apache HTTP Server...
Dec 28 12:38:24 hadoop_zxy httpd[14017]: AH00558: httpd: Could not reliably determine the server's fully qualified domain n...message
Dec 28 12:38:24 hadoop_zxy systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.

三、修改端口


[root@hadoop_zxy conf]# vim /etc/httpd/conf/httpd.conf

在这里插入图片描述

[root@hadoop_zxy conf]# systemctl restart httpd.service

四、测试页面

在这里插入图片描述

五、将HTML页面防止在/var/www/html目录下


[root@hadoop_zxy conf]# cd /var/www/html/
[root@hadoop_zxy html]# ls
index.html
[root@hadoop_zxy html]#

六、测试最终页面

在这里插入图片描述
html页面引用—皮小孩ls

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DATA数据猿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值