新聞中心
Web服務(wù)器在默認(rèn)情況下使用HTTP,這是一個(gè)純文本的協(xié)議。正如其名稱所暗示的,純文本協(xié)議不會對傳輸中的數(shù)據(jù)進(jìn)行任何形式的加密。而基于HTTP的Web服務(wù)器是非常容易配置,它在安全方面有重大缺陷。

成都創(chuàng)新互聯(lián)主營寶坻網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,app軟件開發(fā),寶坻h5成都微信小程序搭建,寶坻網(wǎng)站營銷推廣歡迎寶坻等地區(qū)企業(yè)咨詢
任何”中間人”,通過精心防止的數(shù)據(jù)包嗅探器,是能夠看到任何經(jīng)過的數(shù)據(jù)包內(nèi)容。更進(jìn)一步,惡意用戶甚至可以在傳輸路徑設(shè)置一個(gè)假冒的WEB服務(wù)器冒名頂替實(shí)際的目標(biāo)Web服務(wù)器。在這種情況下,最終用戶可能實(shí)際上與假冒者服務(wù)器,而不是真正的目的服務(wù)器進(jìn)行通信。這樣,惡意用戶可以通過精心設(shè)計(jì)的表單欺騙終端用戶獲取到敏感信息,如用戶名密碼。
為了處理這些類型的漏洞,大多數(shù)供應(yīng)商往往在他們的web服務(wù)器應(yīng)用HTTPS協(xié)議。對于只讀類型的網(wǎng)站,用戶只能讀取內(nèi)容,并沒有實(shí)際提交任何信息,HTTP仍然是一個(gè)可行的選擇。但是,對于保存敏感信息的網(wǎng)站,比如:用戶需要登錄來獲得網(wǎng)站的服務(wù),那么HTTPS是必須的。
接下來演示一下配置https訪問www
首先安裝httpd服務(wù)
[root@localhost ~]# yum install httpd -y
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解決依賴關(guān)系
--> 正在檢查事務(wù)
---> 軟件包 httpd.x86_64.0.2.4.6-67.el7.centos 將被 安裝
--> 正在處理依賴關(guān)系 httpd-tools = 2.4.6-67.el7.centos,它被軟件包 httpd-2.4.6-67.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 /etc/mime.types,它被軟件包 httpd-2.4.6-67.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 libaprutil-1.so.0()(64bit),它被軟件包 httpd-2.4.6-67.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 libapr-1.so.0()(64bit),它被軟件包 httpd-2.4.6-67.el7.centos.x86_64 需要
--> 正在檢查事務(wù)
---> 軟件包 apr.x86_64.0.1.4.8-3.el7 將被 安裝
---> 軟件包 apr-util.x86_64.0.1.5.2-6.el7 將被 安裝
---> 軟件包 httpd-tools.x86_64.0.2.4.6-67.el7.centos 將被 安裝
---> 軟件包 mailcap.noarch.0.2.1.41-2.el7 將被 安裝
--> 解決依賴關(guān)系完成
依賴關(guān)系解決
========================================================================================================================================================================
Package 架構(gòu) 版本 源 大小
========================================================================================================================================================================
正在安裝:
httpd x86_64 2.4.6-67.el7.centos 123 2.7 M
為依賴而安裝:
apr x86_64 1.4.8-3.el7 123 103 k
apr-util x86_64 1.5.2-6.el7 123 92 k
httpd-tools x86_64 2.4.6-67.el7.centos 123 87 k
mailcap noarch 2.1.41-2.el7 123 31 k
事務(wù)概要
========================================================================================================================================================================
安裝 1 軟件包 (+4 依賴軟件包)
總下載量:3.0 M
安裝大?。?0 M
Downloading packages:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
總計(jì) 9.0 MB/s | 3.0 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : apr-1.4.8-3.el7.x86_64 1/5
正在安裝 : apr-util-1.5.2-6.el7.x86_64 2/5
正在安裝 : httpd-tools-2.4.6-67.el7.centos.x86_64 3/5
正在安裝 : mailcap-2.1.41-2.el7.noarch 4/5
正在安裝 : httpd-2.4.6-67.el7.centos.x86_64 5/5
驗(yàn)證中 : httpd-2.4.6-67.el7.centos.x86_64 1/5
驗(yàn)證中 : mailcap-2.1.41-2.el7.noarch 2/5
驗(yàn)證中 : apr-1.4.8-3.el7.x86_64 3/5
驗(yàn)證中 : httpd-tools-2.4.6-67.el7.centos.x86_64 4/5
驗(yàn)證中 : apr-util-1.5.2-6.el7.x86_64 5/5
已安裝:
httpd.x86_64 0:2.4.6-67.el7.centos
作為依賴被安裝:
apr.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-67.el7.centos mailcap.noarch 0:2.1.41-2.el7
完畢!
[root@localhost ~]# rpm -qa|grep httpd
httpd-2.4.6-67.el7.centos.x86_64
httpd-tools-2.4.6-67.el7.centos.x86_64
測試主頁
創(chuàng)建主頁
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# echo "this is a test" >index.html
[root@localhost html]# curl 172.16.1.10
this is a test
安裝相應(yīng)支持模塊
[root@localhost html]# mount /dev/cdrom /mnt
mount: /dev/sr0 寫保護(hù),將以只讀方式掛載
[root@localhost html]# cd /mnt/Packages/
[root@localhost Packages]# rpm -ivh mod_ssl-2.4.6-67.el7.centos.x86_64.rpm
警告:mod_ssl-2.4.6-67.el7.centos.x86_64.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
準(zhǔn)備中... ################################# [100%]
正在升級/安裝...
1:mod_ssl-1:2.4.6-67.el7.centos ################################# [100%]
安裝完成后在/etc/httpd/conf.d會出現(xiàn)ssl.conf文件
建立http使用的私鑰
[root@localhost Packages]# cd /etc/pki/tls/certs
[root@localhost certs]# make myhttpd.key
umask 77 ; \
/usr/bin/openssl genrsa -aes128 2048 > myhttpd.key
Generating RSA private key, 2048 bit long modulus
............+++
...+++
e is 65537 (0x10001)
Enter pass phrase:
Verifying - Enter pass phrase:
[root@localhost certs]# mv myhttpd.key myhttpd.key.raw
[root@localhost certs]# openssl rsa -in myhttpd.key.raw -out myhttpd.key
Enter pass phrase for myhttpd.key.raw:
writing RSA key
[root@localhost certs]# rm -f myhttpd.key.raw
[root@localhost certs]# chmod 400 myhttpd.key
[root@localhost certs]# make myhttpd.crt SERIAL=2015060201
umask 77 ; \
/usr/bin/openssl req -utf8 -new -key myhttpd.key -x509 -days 365 -out myhttpd.crt -set_serial 2015060201
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:cn
string is too long, it needs to be less than 2 bytes long
Country Name (2 letter code) [XX]:ccc
string is too long, it needs to be less than 2 bytes long
Country Name (2 letter code) [XX]:c
string is too short, it needs to be at least 2 bytes long
Country Name (2 letter code) [XX]:cn
State or Province Name (full name) []:hb
Locality Name (eg, city) [Default City]:bd
Organization Name (eg, company) [Default Company Ltd]:ssss
Organizational Unit Name (eg, section) []:info
Common Name (eg, your name or your server's hostname) []:ssss Email Address []:sss [root@localhost certs]# vim /etc/httpd/conf.d/ssl.conf [root@localhost certs]# cp myhttpd.key /etc/pki/tls/private/
重啟httpd
[root@localhost certs]# systemctl restart httpd
測試
選中高級,添加例外
由此,https訪問httpd就實(shí)現(xiàn)了
網(wǎng)頁名稱:通過https訪問www服務(wù)
文章路徑:http://www.5511xx.com/article/dpcoijd.html


咨詢
建站咨詢
