今天就跟大家聊聊有關(guān)RHEL6.3下如何簡(jiǎn)單配置Apache https,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
成都創(chuàng)新互聯(lián)是專(zhuān)業(yè)的徽州網(wǎng)站建設(shè)公司,徽州接單;提供成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作,網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專(zhuān)業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行徽州網(wǎng)站開(kāi)發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專(zhuān)業(yè)做搜索引擎喜愛(ài)的網(wǎng)站,專(zhuān)業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!
在默認(rèn)情況下,Apache允許客戶(hù)端進(jìn)行匿名訪問(wèn),但Apache也可以實(shí)現(xiàn)基于加密的認(rèn)證訪問(wèn)。這里做一個(gè)DEMO的實(shí)現(xiàn)過(guò)程詳解。
一、安裝相應(yīng)支持模塊
首先在/etc/httpd/conf.d下查看有沒(méi)有ssl.conf文件,如果沒(méi)有需要安裝mod_ssl加密支持模塊。
[root@localhost Desktop]# cd /etc/httpd/conf.d
[root@localhost conf.d]# ls
mod_DNSsd.conf README welcome.conf
使用YUM源來(lái)安裝
[root@localhost rhel6]# yum -y install mod_ssl
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
RHEL | 4.0 kB 00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mod_ssl.i686 1:2.2.15-15.el6_2.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mod_ssl i686 1:2.2.15-15.el6_2.1 RHEL 88 k
Transaction Summary
================================================================================
Install 1 Package(s)
Total download size: 88 k
Installed size: 181 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:mod_ssl-2.2.15-15.el6_2.1.i686 1/1
Installed products updated.
Verifying : 1:mod_ssl-2.2.15-15.el6_2.1.i686 1/1
Installed:
mod_ssl.i686 1:2.2.15-15.el6_2.1
Complete!
[root@localhost conf.d]# ls
mod_dnssd.conf README ssl.conf welcome.conf
二、加密配置
在ssl.conf文件中有這么兩句,指出了證書(shū)和私鑰的存放路徑
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
三、證書(shū)生成
[root@localhost conf.d]# cd /etc/pki/tls/certs
[root@localhost certs]# ls
ca-bundle.crt ca-bundle.trust.crt localhost.crt make-dummy-cert Makefile
先刪除原有的localhost.crt證書(shū)文件,再有make命令生成一個(gè)測(cè)試用的證書(shū)文件
[root@localhost certs]# rm -rf localhost.crt
[root@localhost certs]# make testcert
umask 77 ; \
/usr/bin/openssl req -utf8 -new -key /etc/pki/tls/private/localhost.key -x509 -days 365 -out /etc/pki/tls/certs/localhost.crt -set_serial 0
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) [US]:CN
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:Beijing
Organization Name (eg, company) [Default Company Ltd]:Tianli
Organizational Unit Name (eg, section) []:RedHat
Common Name (eg, your name or your server's hostname) []:test1.demo.com
Email Address []:
[root@localhost certs]#
四、測(cè)試驗(yàn)證
[root@localhost certs]# cd /var/www/html
[root@localhost html]# ls
[root@localhost html]# touch index.html
[root@localhost html]# echo "welcomt to beijing" > index.html
[root@localhost html]# cat index.html
welcome to beijing
[root@localhost html]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@localhost html]# links -dump http://test1.demo.com
welcome to beijing
使用http顯示頁(yè)面正常
[root@localhost html]# links -dump https://test1.demo.com
ELinks: SSL error
使用https顯示頁(yè)面則出現(xiàn)SSL error
下面使用瀏覽器看一下效果
[root@localhost html]# firefox
在地址欄中輸入https://test1.demo.com
在如上頁(yè)面中,點(diǎn)擊I Understand the Risks選項(xiàng)
點(diǎn)擊Add Exception
點(diǎn)擊View 可以查看這張自頒發(fā)的證書(shū)信息。
點(diǎn)擊Confirm Security Exception,然后瀏覽器將顯示頁(yè)面內(nèi)容。
看完上述內(nèi)容,你們對(duì)RHEL6.3下如何簡(jiǎn)單配置Apache https有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。