Centos 7 安裝Httpd服務測試http頁面

Apache HTTP Server(簡稱Apache)是Apache軟件基金會的一個開放源代碼的網頁服務器軟件,可以在大多數電腦操作系統中運行,由於其跨平臺和安全性(儘管不斷有新的漏洞被發現,但由於其開放源代碼的特點,漏洞總能被很快修補。因此總合來說,其安全性還是相當高的。)。被廣泛使用,是最流行的Web服務器軟件之一。它快速、可靠並且可通過簡單的API擴充,將Perl/Python等解釋器編譯到服務器中。(摘之他人)

[1] 安裝 httpd.默認全部
[root@localhost ~]# yum -y install httpd

#增加開啓啓動
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl enable httpd

[root@localhost ~]# netstat -lnt | grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     
tcp6       0      0 :::80                   :::*                    LISTEN 


[3] 如果Firewalld正在運行,請允許HTTP服務。,HTTP使用80 / TCP
[root@localhost~]# firewall-cmd --add-service=http --permanent
success
[root@localhost ~]# firewall-cmd --reload
success


[4] 創建一個HTML測試頁,並使用Web瀏覽器從客戶端PC訪問它。如果顯示以下頁面,是正確的
[root@localhost ~]# vi /var/www/html/runroo3.html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>菜鳥教程(runoob.com)</title> 
<style>
div.img {
    border: 1px solid #ccc;
}

div.img:hover {
    border: 1px solid #777;
}

div.img img {
    width: 100%;
    height: auto;
}

div.desc {
    padding: 15px;
    text-align: center;
}

* {
    box-sizing: border-box;
}

.responsive {
    padding: 0 6px;
    float: left;
    width: 24.99999%;
}

@media only screen and (max-width: 700px){
    .responsive {
        width: 49.99999%;
        margin: 6px 0;
    }
}

@media only screen and (max-width: 500px){
    .responsive {
        width: 100%;
    }
}

.clearfix:after {
    content: "";
    display: table;
    clear: both;
}
</style>
</head>
<body>

<h2 style="text-align:center">響應式圖片相冊</h2>

<div class="responsive">
  <div class="img">
    <a target="_blank" href="img_fjords.jpg">
      <img src="http://www.runoob.com/wp-content/uploads/2016/04/img_fjords.jpg" alt="Trolltunga Norway" width="300" height="200">
    </a>
    <div class="desc">Add a description of the image here</div>
  </div>
</div>


<div class="responsive">
  <div class="img">
    <a target="_blank" href="img_forest.jpg">
      <img src="http://www.runoob.com/wp-content/uploads/2016/04/img_forest.jpg" alt="Forest" width="600" height="400">
    </a>
    <div class="desc">Add a description of the image here</div>
  </div>
</div>

<div class="responsive">
  <div class="img">
    <a target="_blank" href="img_lights.jpg">
      <img src="http://www.runoob.com/wp-content/uploads/2016/04/img_lights.jpg" alt="Northern Lights" width="600" height="400">
    </a>
    <div class="desc">Add a description of the image here</div>
  </div>
</div>

<div class="responsive">
  <div class="img">
    <a target="_blank" href="img_mountains.jpg">
      <img src="http://www.runoob.com/wp-content/uploads/2016/04/img_mountains.jpg" alt="Mountains" width="600" height="400">
    </a>
    <div class="desc">Add a description of the image here</div>
  </div>
</div>

<div class="clearfix"></div>

<div style="padding:6px;">
  
  <h4>重置瀏覽器大小查看效果</h4>
</div>

</body>
</html>

 

測試:

總結:安裝httpd服務,部署調試正常頁面應該不難。

但vim配置文件時,需要更改成訪問地址成爲域名地址,需要公網地址來綁定。所以我修改完conf文件後,重啓httpd服務不成功。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章